Ejemplo n.º 1
0
        protected override void Run()
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException += (s, a) => Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {a.ExceptionObject}");

                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
                BootstrapperDispatcher.UnhandledException += (s, a) => Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {a.Exception}");

                RootView         = new MainWindowView(this);
                RootView.Closed += (s, a) => BootstrapperDispatcher.InvokeShutdown();

                Engine.Detect();

                if (Command.Display == Display.Passive || Command.Display == Display.Full)
                {
                    RootView.Show();
                    Dispatcher.Run();
                }

                Engine.Quit(RootView.ViewModel.Status);
            }
            catch (Exception e)
            {
                Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        protected override void Run()
        {
            // To get the command line arguments

            /*foreach (var commandLineArgs in this.Command.GetCommandLineArgs())
             * {
             *
             * }*/

            MessageBox.Show(BundleName);

            try
            {
                this.Engine.CloseSplashScreen();

                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;

                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new SetupWizard(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();
                this.Engine.Detect();

                RootView.Show();
                Dispatcher.Run();
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Ejemplo n.º 3
0
        protected override void Run()
        {
            // On an English system, the user can change the language to Japanese, so
            // detect the user language, and not the system.
            var code        = int.Parse(this.Engine.FormatString("[UserUILanguageID]"));
            var cultureInfo = CultureInfo.GetCultureInfo(code);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
            Localisation.Culture = cultureInfo;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(cultureInfo.IetfLanguageTag)));
            try
            {
                this.Engine.CloseSplashScreen();

                InitializeP4Variables();

                FormatVersionForPage();

                var rebootPending = this.Engine.StringVariables["RebootPending"];
                if (!string.IsNullOrEmpty(rebootPending) && rebootPending != "0")
                {
                    if (this.Command.Display == Display.Full)
                    {
                        MessageBox.Show(
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogBody, this.BundleName),
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogTitle, this.BundleName),
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                    this.Engine.Quit(3010);
                }

                this.Engine.Log(LogLevel.Verbose, "Launching Burn frontend");
                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
                AppDomain.CurrentDomain.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.ExceptionObject}");
                };
                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new WizardWindow(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();

                this.Engine.Detect();

                //System.Diagnostics.Debugger.Launch();
                if (this.Command.Display == Display.Passive || this.Command.Display == Display.Full)
                {
                    RootView.Show();
                    Dispatcher.Run();
                }

                this.Engine.Quit(RootView.ViewModel.Status);
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Ejemplo n.º 4
0
        protected override void Run()
        {
            var code        = int.Parse(this.Engine.FormatString("[SystemLanguageID]"));
            var cultureInfo = CultureInfo.GetCultureInfo(code);

            Thread.CurrentThread.CurrentCulture   = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
            Localisation.Culture = cultureInfo;

            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
                                                                   XmlLanguage.GetLanguage(cultureInfo.IetfLanguageTag)));
            try
            {
                this.Engine.CloseSplashScreen();

                var rebootPending = this.Engine.StringVariables["RebootPending"];
                if (!string.IsNullOrEmpty(rebootPending) && rebootPending != "0")
                {
                    if (this.Command.Display == Display.Full)
                    {
                        MessageBox.Show(
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogBody, this.BundleName),
                            string.Format(Localisation.WixBootstrapper_RestartPendingDialogTitle, this.BundleName),
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                    this.Engine.Quit(3010);
                }

                this.Engine.Log(LogLevel.Verbose, "Launching Burn frontend");
                BootstrapperDispatcher = Dispatcher.CurrentDispatcher;
                AppDomain.CurrentDomain.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.ExceptionObject}");
                };
                BootstrapperDispatcher.UnhandledException +=
                    (sender, args) =>
                {
                    this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {args.Exception}");
                };

                RootView         = new WizardWindow(this);
                RootView.Closed += (sender, args) => BootstrapperDispatcher.InvokeShutdown();

                this.Engine.Detect();

                foreach (var commandLineArg in this.Command.GetCommandLineArgs())
                {
                    if (commandLineArg.StartsWith("InstallationType=", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var param = commandLineArg.Split(new[] { '=' }, 2);
                        RootView.ViewModel.PackageCombinationConfiguration.InstallationType =
                            (InstallationType)Enum.Parse(typeof(InstallationType), param[1]);
                    }
                }
                if (this.Command.Display == Display.Passive || this.Command.Display == Display.Full)
                {
                    RootView.Show();
                    Dispatcher.Run();
                }

                this.Engine.Quit(RootView.ViewModel.Status);
            }
            catch (Exception e)
            {
                this.Engine.Log(LogLevel.Error, $"Critical bootstrapper exception: {e}");
                throw e;
            }
        }
Ejemplo n.º 5
0
        private void SetLaunchAction(Display gui)
        {
            if (launchAction == LaunchAction.Install) // Install
            {
                Log($"What have I to do? : {launchAction}");

                PlanPackageBegin += SetInstallPackagePlannedState;

                ApplyComplete += (o, e) =>
                {
                    ActionResult = e.Status >= 0 ? ActionResult.Success : ActionResult.Failure;
                    MainViewModel.Instance.NavigateFromOffset(1);
                };

                try
                {
                    BootstrapperDispatcher.Invoke(() =>
                    {
                        MainView view = new MainView();
                        view.Closed  += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                        view.Show();
                    });
                }
                catch (Exception ex)
                {
                    LogExceptionWithInner(ex);
                }
            }
            else if (launchAction == LaunchAction.UpdateReplace) // Update
            {
                Log($"What have I to do? : {launchAction}");

                PlanPackageBegin += SetUpdatePackagePlannedState;

                ApplyComplete += (o, e) =>
                {
                    ActionResult = e.Status >= 0 ? ActionResult.Success : ActionResult.Failure;
                    UninstallViewModel.Instance.NavigateFromOffset(1);
                };

                try
                {
                    BootstrapperDispatcher.Invoke(() =>
                    {
                        UninstallView view = new UninstallView();
                        view.Closed       += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                        view.Show();
                    });
                }
                catch (Exception ex)
                {
                    LogExceptionWithInner(ex);
                }
            }
            else if (launchAction == LaunchAction.Repair) // Repair
            {
                Log($"What have I to do? : {launchAction}");

                PlanPackageBegin += SetRepairPackagePlannedState;

                ApplyComplete += (o, e) =>
                {
                    ActionResult = e.Status >= 0 ? ActionResult.Success : ActionResult.Failure;
                    UninstallViewModel.Instance.NavigateFromOffset(1);
                };

                try
                {
                    BootstrapperDispatcher.Invoke(() =>
                    {
                        UninstallView view = new UninstallView();
                        view.Closed       += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                        view.Show();
                    });
                }
                catch (Exception ex)
                {
                    LogExceptionWithInner(ex);
                }
            }
            else if (launchAction == LaunchAction.Uninstall) // Uninstall
            {
                Log($"What have I to do? : {launchAction}");

                PlanPackageBegin += SetUninstallPackagePlannedState;

                ApplyComplete += (o, e) =>
                {
                    ActionResult = e.Status >= 0 ? ActionResult.Success : ActionResult.Failure;
                    if (gui == Display.None || gui == Display.Embedded)
                    {
                        BootstrapperDispatcher.Invoke(() => Engine.Quit((int)ActionResult));
                    }
                    else
                    {
                        UninstallViewModel.Instance.NavigateFromOffset(1);
                    }
                };

                if (gui == Display.None || gui == Display.Embedded)
                {
                    Engine.Plan(LaunchAction.Uninstall);
                    Engine.Apply(IntPtr.Zero);
                }
                else
                {
                    try
                    {
                        BootstrapperDispatcher.Invoke(() =>
                        {
                            UninstallView view = new UninstallView();
                            view.Closed       += (sender, e) => BootstrapperDispatcher.InvokeShutdown();
                            view.Show();
                        });
                    }
                    catch (Exception ex)
                    {
                        LogExceptionWithInner(ex);
                    }
                }
            }
        }