Files
Keys/App/UI/MainWindow.cs

21 lines
736 B
C#

namespace App.UI;
public class MainWindow
{
public Adw.Window Window { get; }
public MainWindow()
{
var assembly = typeof(MainWindow).Assembly;
using var stream = assembly.GetManifestResourceStream("App.UI.MainWindow.xml");
if (stream == null)
throw new Exception("Failed to load embedded resource MainWindow.xml");
using var reader = new System.IO.StreamReader(stream);
var xml = reader.ReadToEnd();
var builder = Gtk.Builder.NewFromString(xml, -1);
var window = builder.GetObject("main_window") as Adw.Window;
if (window == null)
throw new Exception("Failed to load main_window from MainWindow.ui");
Window = window;
}
}