private static bool NotUninstallingDuringUpgrade(BootstrapperApplicationModel model)
 {
     // LaunchAction.Uninstall && Display.Embedded means uninstall is called from
     // another bootstrapper during an upgrade.
     return(!(model.BootstrapperApplication.Command.Action == LaunchAction.Uninstall &&
              model.BootstrapperApplication.Command.Display == Display.Embedded));
 }
        public MainWindowModel(BootstrapperApplicationModel model)
        {
            this.model = model;
            State      = InstallState.Initializing;
            WireUpEventHandlers();

            CancelCommand = new DelegateCommand(() =>
            {
                this.model.LogMessage("Cancelling...");
                FuseBootstrapperApplication.Dispatcher.InvokeShutdown();
            }, () => State != InstallState.Cancelled);

            _progressModel = new ProgressViewModel(CancelCommand);
            InstallCommand = new DelegateCommand(() =>
            {
                _progressModel.Title = "Installing Fuse";
                InnerContent         = new ProgressView(_progressModel);
                this.model.PlanAction(LaunchAction.Install);
            }, () => true);
            UninstallCommand = new DelegateCommand(() =>
            {
                _progressModel.Title = "Uninstalling Fuse";
                InnerContent         = new ProgressView(_progressModel);
                this.model.PlanAction(LaunchAction.Uninstall);
            }, () => true);

            InnerContent = model.BootstrapperApplication.Command.Action == LaunchAction.Uninstall
                                ? (FrameworkElement) new UninstallView(new UninstallViewModel(UninstallCommand))
                                : (FrameworkElement) new InstallerView(new InstallerViewModel(InstallCommand, CancelCommand));
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            var model     = new BootstrapperApplicationModel(new FuseBootstrapperApplication());
            var viewModel = new MainWindowModel(model);
            var view      = new MainWindow(viewModel);

            model.SetWindowHandle(view);
            view.Show();
            new App().Run(view);
        }
        protected override void Run()
        {
            Dispatcher = Dispatcher.CurrentDispatcher;

            var model     = new BootstrapperApplicationModel(this);
            var viewModel = new MainWindowModel(model);
            var view      = new MainWindow(viewModel);

            model.SetWindowHandle(view);
            Engine.Detect();
            if (NotUninstallingDuringUpgrade(model))
            {
                view.Show();
            }
            Dispatcher.Run();
            Engine.Quit(model.FinalResult);
        }