protected override void OnStartup(StartupEventArgs e) { var settings = new WebUiClientConfig(); var settingsPath = Path.Combine(Directory.GetCurrentDirectory(), "Config" + Path.DirectorySeparatorChar + "WebUiClient.json"); settings.Load(settingsPath); var webUi = settings.WebUiClients[settings.CurrentWebUiClient]; if (!webUi.IsUpToDate()) { webUi.DonwloadAndInstall(); } if (!webUi.IsInstalled()) { return; } // Initialization must be performed here, // before creating a WebControl. if (!WebCore.IsInitialized) { var baseUri = new Uri(Assembly.GetEntryAssembly().Location); WebCore.Initialize(new WebConfig { HomeURL = new Uri(baseUri, webUi.HomeUri), LogPath = @".\starter.log", LogLevel = LogLevel.Verbose, RemoteDebuggingPort = 9033 }); } base.OnStartup(e); }
private void webWindow_Loaded(object sender, RoutedEventArgs e) { var settingsPath = Path.Combine(Directory.GetCurrentDirectory(), "WebUi" + Path.DirectorySeparatorChar + "Config.json"); _settings.Load(settingsPath); var webUi = _settings.WebUiClients[_settings.CurrentWebUiClient]; if (!webUi.IsInstalled()) { var inputDialog = new WebUiClientSelector(_settings); if (inputDialog.ShowDialog() == true) { if (inputDialog.DialogResult == true) { _settings.CurrentWebUiClient = inputDialog.CurrentWebUiClient; webUi = _settings.WebUiClients[_settings.CurrentWebUiClient]; } } } else if (_settings.AutoUpdateWebUiClient && !webUi.IsUpToDate()) { var inputDialog = new WebUiClientSelector(_settings, true); if (inputDialog.ShowDialog() == true) { if (inputDialog.DialogResult == true) { _settings.CurrentWebUiClient = inputDialog.CurrentWebUiClient; webUi = _settings.WebUiClients[_settings.CurrentWebUiClient]; } } } if (!webUi.IsInstalled()) { return; } Title = "NecroBot-Private Team GUI / " + _settings.CurrentWebUiClient; // Tell the WebControl to load a specified target URL. var baseUri = new Uri(Assembly.GetEntryAssembly().Location); Source = new Uri(baseUri, webUi.HomeUri); }