Exemple #1
0
        public void Application_Startup(object sender, StartupEventArgs e)
        {
            var wix   = new WixStateProvider(Product.Elasticsearch, "5.5.1");
            var model = ElasticsearchInstallationModel.Create(wix, NoopSession.Elasticsearch);

            var window = new MainWindow(model, new ManualResetEvent(false));

            model.InstallUITask = async() =>
            {
                await Task.Delay(TimeSpan.FromSeconds(1));

                return(Observable.Return(ClosingResult.Success));
            };
            model.AllSteps.Last().IsSelected = true;
            window.Show();

            RxApp.MainThreadScheduler = new DispatcherScheduler(Application.Current.Dispatcher);
            Application.Current.Resources["InstallerTitle"] = wix.CurrentVersion.ToString();
        }
        private void Run()
        {
            this._app = new Application();
            RxApp.MainThreadScheduler = new DispatcherScheduler(_app.Dispatcher);

            if (!this._session.TryGetValue("CurrentVersion", out var version))
            {
                throw new Exception("CurrentVersion not found in session state.");
            }

            if (!this._session.TryGetValue("ElasticProduct", out var product))
            {
                throw new Exception("ElasticProduct not found in session state.");
            }

            var wixStateProvider = new WixStateProvider(GetProduct(product), version, installationInProgress: false);

            this._mainWindow = GetMainWindow(product, wixStateProvider, new SessionWrapper(_session));

            Application.ResourceAssembly = _mainWindow.GetType().Assembly;
            this._app.Run(this._mainWindow as Window);
            this._installExitEvent.Set();
        }