Пример #1
0
        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);
        }