public MainWindow() { InitializeComponent(); Title = App.Title; Version.Content = $"v {App.Version}"; MainPage.MainWindow = this; LocalPage.MainWindow = this; DownloadsPage.MainWindow = this; try { if (!File.Exists(ConfigManager.Path)) { MessageHelper.Error($"File '{Path.GetFileName(ConfigManager.Path)}' does not exist!"); Close(); return; } Config = ConfigManager.Load(); Prefs = PrefsManager.Load(); } catch (Exception e) { MessageHelper.ThrowException(e); Close(); return; } if (Config != null && Prefs != null) { Image.Load(Config.Logo); BackgroundImage.Load(Config.Background); Title = Config.Title ?? ""; Width = Prefs.Width; Height = Prefs.Height; WindowState = Prefs.WindowState; TabControl = new TabHost(Tabs, FrameView, Tab, new Page[] { MainPage, LocalPage, DownloadsPage /*, SettingsPage*/ }); GetVersionsFromWeb((response) => { Versions = response; DownloadsPage.Update(response); }); Closing += OnWindowClosing; } else { MessageHelper.Error("Config is empty: " + ConfigManager.Path); Close(); return; } }