[wix-users] MBA Reboots

Patel, Jeel J jeel.j.patel at boeing.com
Mon Feb 1 12:36:43 PST 2016


I have a Managed Bootstrapper Application written in Wix and I am having trouble handling reboots. So far I have an exe package with an exitcode

<ExitCode Value ="3010" Behavior="forceReboot"/>

<ExitCode Value ="0" Behavior="success"/>



Also, In my Run Method I have

 protected override void Run()

        {

            Dispatcher = Dispatcher.CurrentDispatcher;



            // Our model wraps the Calls to the Burn engine.

            var model = new BootstrapperApplicationModel(this);



            // Process commands trigger by the view and pass the data to the model

            var viewModel = new WelcomeScreenViewModel(model);



            view = new WelcomeScreen(viewModel);



            if (this.Command.Resume == ResumeType.Reboot)

            {

                model.SetWindowHandle(view);

                this.Engine.Detect();

                model.PlanAction(LaunchAction.Install);

                view.Show();

                Dispatcher.Run();

                //this.Engine.Quit(model.FinalResult);

            }

            else

            {

                if (this.Command.Action == LaunchAction.Install)

                {

                    // This method will get a handle to the WPF window which is needed by the Burn engine when performing the install or uninstall

                    model.SetWindowHandle(view);



                    // This gives the Burn engine the go ahead to check if our bundle is already installed or not. That way when our GUI shows up we can disable and enable

                    // approraite buttons. This is called after instantiating our view, viewmodels and model object. (Sets ups some event handlers)

                    this.Engine.Detect();



                    // dispaly our GUI

                    view.Show();



                    Dispatcher.Run();



                    model.bootstrapperApplication.Engine.Quit(0);

                }

                else if (this.Command.Action == LaunchAction.Uninstall)

                {

                    this.Engine.Detect();

                    model.PlanAction(LaunchAction.Uninstall);

                    model.Quit(false);

                }

            }

        }This is my ApplyComplete Event Handler

  protected void ApplyComplete(object sender, ApplyCompleteEventArgs e)

    {

        this.model.FinalResult = e.Status;

        if (model.bootstrapperApplication.Command.Action == LaunchAction.Uninstall)

        {

            model.bootstrapperApplication.Engine.Quit(0);

        }

        else

        {

            BootstrapperApplication.Dispatcher.BeginInvoke((Action)delegate ()

            {

                BootstrapperApplication.view.Close();

            });



            BootstrapperApplication.Dispatcher.InvokeShutdown();

            if (e.Restart == ApplyRestart.RestartInitiated || e.Restart == ApplyRestart.RestartRequired)

                {

                    MessageBox.Show("A Restart is required. Machine will now reboot...", "Installation");

                    e.Result = Result.Restart;

                }

        }



    }





How do I have it restart to the point it left or how can I modify this to restart the bootstrapper at the end.

Thank you,



Jeel Patel
Software Engineer 1
Network Centric Operations Management (NCOM) Team
Email: jeel.j.patel at boeing.com<mailto:jeel.j.patel at boeing.com>
Phone: (314) 545-2392



More information about the wix-users mailing list