Esempio n. 1
0
        public void Initialize()
        {
            try
            {
                _installer = _container.Resolve<BootstrapperApplication>();
            }
            catch
            {
            }

            RegisterViewsAndServices();

            if (_installer == null || (_installer.Command.Display == Display.Passive || _installer.Command.Display == Display.Full))
            {
                var navigationManager = _container.Resolve<NavigationManager>();

                var mainViewModel = _container.Resolve<IMainViewModel>();
                var mainNavigationItem = new NavigationItem(NavigationNames.Main, mainViewModel);
                navigationManager.RegisterNavigationItem(mainNavigationItem);

                var helpViewModel = _container.Resolve<IHelpViewModel>();
                var helpNavigationItem = new NavigationItem(NavigationNames.Help, helpViewModel);
                navigationManager.RegisterNavigationItem(helpNavigationItem);

                navigationManager.Navigate(mainNavigationItem);

                if (_installer != null) _installer.Engine.CloseSplashScreen();
            }
        }
        public ShellViewModel(BootstrapperApplication ba)
        {
            this.DisplayName = "SampleApp Installer";

            this.ba = ba;
            downloadRetries = new Dictionary<string, int>();

            ba.DetectBegin += DetectBegin;
            ba.DetectPackageComplete += DetectedPackage;
            ba.DetectRelatedBundle += DetectedRelatedBundle;
            ba.DetectComplete += DetectComplete;

            ba.PlanPackageBegin += PlanPackageBegin;
            ba.PlanComplete += PlanComplete;

            ba.ApplyBegin += ApplyBegin;
            ba.ApplyComplete += ApplyComplete;

            ba.ResolveSource += ResolveSource;
            ba.Error += ExecuteError;

            ba.ExecuteMsiMessage += this.ExecuteMsiMessage;
            ba.ExecuteProgress += this.ApplyExecuteProgress;
            ba.Progress += this.ApplyProgress;
            ba.CacheAcquireProgress += this.CacheAcquireProgress;
            ba.CacheComplete += this.CacheComplete;
        }
		public MainViewModel(
			BootstrapperApplication installer, 
			Engine engine, 
			IViewModelsFactory<IOperationCompletedStepViewModel> completedStepVmFactory,
			IViewModelsFactory<IInstallationStepViewModel> installationStepVmFactory,
			NavigationManager navigationManager,
			IViewModelsFactory<IOperationProgressStepViewModel> progressStepVmFactory,
			IViewModelsFactory<IModificationStepViewModel> modificationStepVmFactory,
			IViewModelsFactory<ILayoutStepViewModel> layoutVmFactory)
			: this()
		{
			_completedStepVmFactory = completedStepVmFactory;
			_installationStepVmFactory = installationStepVmFactory;
			_navigationManager = navigationManager;
			_progressStepVmFactory = progressStepVmFactory;
			_modificationStepVmFactory = modificationStepVmFactory;
			_layoutVmFactory = layoutVmFactory;

			IsInitializing = true;

			PropertyChanged += OnPropertyChanged;
			Cancelled = false;
			_installer = installer;
			_engine = engine;

			if (_installer.Command.Display == Display.Passive || _installer.Command.Display == Display.Full)
			{
				OnUIThread(() => Application.Current.MainWindow.Closing += OnClosing);
			}

			SubscribeToInstallationEvents();
		}
 //constructor
 public MainViewModel(BootstrapperApplication bootstrapper)
 {
     IsThinking = false;
     Bootstrapper = bootstrapper;
     Bootstrapper.ApplyComplete += OnApplyComplete;
     Bootstrapper.DetectPackageComplete += OnDetectPackageComplete;
     Bootstrapper.PlanComplete += OnPlanComplete;
 }
Esempio n. 5
0
        public WindowBase(BootstrapperApplication bootstrapper)
        {
            bootstrapper.ApplyComplete += OnApplyComplete;
            bootstrapper.PlanComplete += OnPlanComplete;
            bootstrapper.Error += (sender, args) => _completionSource.TrySetException(new Exception(args.ErrorMessage));

            Engine = bootstrapper.Engine;
        }
Esempio n. 6
0
 public InstallWindow(BootstrapperApplication bootstrapper)
     : base(bootstrapper)
 {
     InitializeComponent();
     _selectedInstallPath = System.IO.Path.Combine(
         Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
         "Magic");
 }
        public CaliburnMicroBootstrapper(BootstrapperApplication app)
        {
            LogManager.GetLog = type => new WixLog(app.Engine, type);

            this._app = app;

            Initialize();
            SetupContainer();
        }
Esempio n. 8
0
 public ProtectModel(BootstrapperApplication bootstrapper)
     : base(bootstrapper)
 {
     Product = ProductType.Protect;
     LayoutDirectory =
      Path.GetDirectoryName(
          Process.GetProcessesByName("Workshare.Protect.Bundle").First().MainModule.FileName);
     GettingStartedGuidePath = Path.Combine(InstallDirectory,
         "Modules\\Readme\\Workshare Protect Getting Started Guide.pdf");	
 }
        //constructor
        public MainViewModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;

            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
            this.Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
            this.Bootstrapper.PlanComplete += this.OnPlanComplete;
            this.Bootstrapper.CacheAcquireProgress += this.CacheAcquireProgress;
        }
Esempio n. 10
0
    public MainViewModel(BootstrapperApplication bootstrapper)
    {
        this.IsBusy = false;

        this.Bootstrapper = bootstrapper;
        this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
        this.Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
        this.Bootstrapper.PlanComplete += this.OnPlanComplete;

        this.Bootstrapper.Engine.Detect();
    }
Esempio n. 11
0
        //constructor
        public MainViewModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;

            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
            this.Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
            this.Bootstrapper.PlanComplete += this.OnPlanComplete;

            this.LogText = this.Bootstrapper.Engine.StringVariables["Log"];
        }
		public OperationProgressStepViewModel(
			BootstrapperApplication installer,
			Engine engine,
			IViewModelsFactory<IMainViewModel> mainVmFactory)
		{
			_installer = installer;
			_engine = engine;
			_mainVmFactory = mainVmFactory;

			SubscribeToInstallationEvents();
		}
Esempio n. 13
0
        /// <summary>
        ///     Creates a new model for the UX.
        /// </summary>
        /// <param name="bootstrapper">Bootstrapper hosting the UX.</param>
        protected Model(BootstrapperApplication bootstrapper)
        {
            Bootstrapper = bootstrapper;

            // Set the default values ( this can be overridden with the command line)
            InstallDirectory = Environment.Is64BitOperatingSystem
                ? @"C:\Program Files (x86)\Workshare\"
                : @"C:\Program Files\Workshare\";

            Features = new ProductFeatures(this);
            DetectUpgrade();
        }
Esempio n. 14
0
		public MainViewModel(BootstrapperApplication bootstrapper)
		{
			InstallCommand = new RelayCommand(OnInstall, () => InstallEnabled == true);
			UninstallCommand = new RelayCommand(OnUninstall, () => UninstallEnabled == true);
			ExitCommand = new RelayCommand(OnExit);

			Bootstrapper = bootstrapper;
			Bootstrapper.ApplyComplete += this.OnApplyComplete;
			Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
			Bootstrapper.PlanComplete += this.OnPlanComplete;

			try
			{
				IsSQLEnabled = (Bootstrapper.Engine.StringVariables["InstallSQL"] == "1" || 
					Bootstrapper.Engine.StringVariables["InstallSQL_64"] == "1");
			}
			catch (System.Exception e)
			{
				MessageBox.Show(e.Message);	
			}
			
			IsThinking = false;
		}
Esempio n. 15
0
		public MainViewModel(BootstrapperApplication bootstrapper)
		{
			_bootstrapper = bootstrapper;
			_bootstrapper.ApplyComplete += this.OnApplyComplete;
			_bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
			_bootstrapper.PlanComplete += this.OnPlanComplete;

			InstallCommand = new RelayCommand(OnInstall, CanInstall);
			UninstallCommand = new RelayCommand(OnUninstall, CanUninstall);
			ExitCommand = new RelayCommand(OnExit);
			
			using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
			{
				var instanceNames = hklm.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL", false).GetValueNames();
				if (!instanceNames.Any(x => x == "FIRESECINSTANCE"))
				{
					CanInstallSQL = true;
					IsInstallSQL = true;
				}
			}
			
			HeaderText = "Установка ОПС Firesec-2";
			_bootstrapper.Engine.Detect();
		}
Esempio n. 16
0
        public MainWindowModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;
            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.PlanPackageBegin += SetPackagePlannedState;
            this.Bootstrapper.PlanMsiFeature += SetFeaturePlannedState;
            this.Bootstrapper.PlanComplete += PlanComplete;

            _settingsStorage = new SettingsStorage();
            _settings = _settingsStorage.LoadSettings();

            if (_settings.GtaPath == null)
            {
                _settings.GtaPath = "";
            }

            if (!Util.IsValidGtaFolder(_settings.GtaPath))
            {
                var registryPath = Util.GetGtaInstallPathFromRegistry();
                if (Util.IsValidGtaFolder(registryPath))
                {
                    _settings.GtaPath = registryPath;
                }
                else
                {
                    _settings.GtaPath = "";
                }
            }
            StatusText = "Ready.";
            _updater = new Updater(_settings);
            _updater.ModInstalled += UpdaterOnModInstalled;
            _updater.ScriptHookVInstalled += UpdaterOnScriptHookVInstalled;
            _updater.ScriptHookVRemoved += UpdaterOnScriptHookVRemoved;
            _updater.ModRemoved += UpdaterOnModRemoved;
            _updater.UpdatesChecked += UpdaterOnUpdatesChecked;
        }
Esempio n. 17
0
 public Bootstrapper(BootstrapperApplication installer)
 {
     _installer = installer;
 }
Esempio n. 18
0
 public UninstallWindow(BootstrapperApplication bootstrapper)
     : base(bootstrapper)
 {
     InitializeComponent();
 }
        public ProgressViewModel(RootViewModel root)
        {
            _root = root;
            _executingPackageOrderIndex = new Dictionary<string, int>();

            _root.PropertyChanged += RootPropertyChanged;

            _ba = Bootstrapper.Model.Bootstrapper;
            _ba.CacheAcquireBegin += (s, e) => CacheMessage = string.Format("{0}ing {1}", e.Operation, e.PackageOrContainerId);
            _ba.ExecuteMsiMessage += ExecuteMsiMessage;
            _ba.ExecuteProgress += ApplyExecuteProgress;
            _ba.PlanBegin += PlanBegin;
            _ba.PlanPackageComplete += PlanPackageComplete;
            _ba.Progress += ApplyProgress;
            _ba.CacheAcquireProgress += CacheAcquireProgress;
            _ba.CacheComplete += CacheComplete;
            CacheMessage = "Acquisition progress";
#if false
            #region Verbose logging for many bootstrapper events

            // Fired when the engine has begun installing the bundle
            _ba.ApplyBegin += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "ApplyBegin");

            // Fired when the engine has completed installing the bundle
            _ba.ApplyComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ApplyComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Restart: {0}", e.Restart));
            };

            // Fired when the engine has begun acquiring the installation sources
            _ba.CacheAcquireBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheAcquireBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Operation: {0}", e.Operation));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageOrContainerId: {0}", e.PackageOrContainerId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Source: {0}", e.Source));
            };

            // Fired when the engine has completed the acquisition of the installation sources
            _ba.CacheAcquireComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheAcquireComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageOrContainerId: {0}", e.PackageOrContainerId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
            };

            // Fired when the engine has progress aquiring the installation sources
            _ba.CacheAcquireProgress += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheAcquireProgress");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    OverallPercentage: {0}", e.OverallPercentage));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageOrContainerId: {0}", e.PackageOrContainerId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Progress: {0}", e.Progress));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Total: {0}", e.Total));
            };

            // Fired when the engine has begun caching the installation sources
            _ba.CacheBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Result: {0}", e.Result));
            };

            // Fired when the engine has cached the installation sources
            _ba.CacheComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Status: {0}", e.Status));
            };

            // Fired when the engine has begun caching a specific package
            _ba.CachePackageBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CachePackageBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    CachePayloads: {0}", e.CachePayloads));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageCacheSize: {0}", e.PackageCacheSize));
            };

            // Fired when the engine has completed caching a specific package
            _ba.CachePackageComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CachePackageComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
            };

            // Fired when the engine begins the verification of the acquired installation sources
            _ba.CacheVerifyBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheVerifyBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
            };

            // Fired when the engine has completed the verification of the acquired installation sources
            _ba.CacheVerifyComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "CacheVerifyComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
            };

            // Fired when the overall detection phase has begun
            _ba.DetectBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageCount: {0}", e.PackageCount));
            };

            // Fired when the detection phase has completed
            _ba.DetectComplete += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "DetectComplete");

            // Fired when a feature in an MSI package has been detected
            _ba.DetectMsiFeature += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectMsiFeature");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    FeatureId: {0}", e.FeatureId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the detection for a specific package has begun
            _ba.DetectPackageBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectPackageBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
            };

            // Fired when the detection for a specific package has completed
            _ba.DetectPackageComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectPackageComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the detection for a prior bundle has begun
            _ba.DetectPriorBundle += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectPriorBundle");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    BundleId: {0}", e.BundleId));
            };

            // Fired when a related bundle has been detected for a bundle
            _ba.DetectRelatedBundle += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectRelatedBundle");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    BundleTag: {0}", e.BundleTag));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Operation: {0}", e.Operation));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PerMachine: {0}", e.PerMachine));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProductCode: {0}", e.ProductCode));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Version: {0}", e.Version));
            };

            // Fired when a related MSI package has been detected for a package
            _ba.DetectRelatedMsiPackage += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectRelatedMsiPackage");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Operation: {0}", e.Operation));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PerMachine: {0}", e.PerMachine));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProductCode: {0}", e.ProductCode));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Version: {0}", e.Version));
            };

            // Fired when an MSP package detects a target MSI package has been detected
            _ba.DetectTargetMsiPackage += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "DetectTargetMsiPackage");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProductCode: {0}", e.ProductCode));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine is about to start the elevated process
            _ba.Elevate += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "Elevate");

            // Fired when the engine has encountered an error
            _ba.Error += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "Error");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Data: {0}", e.Data));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ErrorCode: {0}", e.ErrorCode));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ErrorMessage: {0}", e.ErrorMessage));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ErrorType: {0}", e.ErrorType));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    UIHint: {0}", e.UIHint));
            };

            // Fired when the engine has begun installing packages
            _ba.ExecuteBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecuteBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageCount: {0}", e.PackageCount));
            };

            // Fired when the engine has completed installing packages
            _ba.ExecuteComplete += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "ExecuteComplete");

            // Fired when the Windows Installer sends a files in use installation message
            _ba.ExecuteFilesInUse += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecuteFilesInUse");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                for (var dataIndex = 0; dataIndex < e.Files.Count; dataIndex++)
                    _ba.Engine.Log(LogLevel.Verbose, string.Format("    File[{0}]: \"{1}\"", dataIndex, e.Files[dataIndex]));
            };

            // Fired when the Windows Installer sends an installation message
            _ba.ExecuteMsiMessage += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecuteMsiMessage");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    DisplayParameters: {0}", e.DisplayParameters));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Message: {0}", e.Message));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    MessageType: {0}", e.MessageType));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                for (var dataIndex = 0; dataIndex < e.Data.Count; dataIndex++)
                    _ba.Engine.Log(LogLevel.Verbose, string.Format("    Data[{0}]: \"{1}\"", dataIndex, e.Data[dataIndex]));
            };

            // Fired when the engine has begun installing a specific package
            _ba.ExecutePackageBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecutePackageBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ShouldExecute: {0}", e.ShouldExecute));
            };

            // Fired when the engine has completed installing a specific package
            _ba.ExecutePackageComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecutePackageComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Restart: {0}", e.Restart));
            };

            // Fired when the engine executes one or more patches targeting a product
            _ba.ExecutePatchTarget += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecutePatchTarget");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    TargetProductCode: {0}", e.TargetProductCode));
            };

            // Fired when the engine executes one or more patches targeting a product
            _ba.ExecuteProgress += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ExecuteProgress");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    OverallPercentage: {0}", e.OverallPercentage));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProgressPercentage: {0}", e.ProgressPercentage));
            };

            // Fired when the engine has begun planning the installation
            _ba.PlanBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageCount: {0}", e.PackageCount));
            };

            // Fired when the engine has completed planning the installation
            _ba.PlanComplete += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "PlanComplete");

            // Fired when the engine is about to plan a feature in an MSI package
            _ba.PlanMsiFeature += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanMsiFeature");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    FeatureId: {0}", e.FeatureId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine has begun planning the installation of a specific package
            _ba.PlanPackageBegin += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanPackageBegin");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine has begun planning the installation of a specific package
            _ba.PlanPackageComplete += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanPackageComplete");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Execute: {0}", e.Execute));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Requested: {0}", e.Requested));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Rollback: {0}", e.Rollback));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine has begun planning for a related bundle
            _ba.PlanRelatedBundle += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanRelatedBundle");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    BundleId: {0}", e.BundleId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine is about to plan the target MSI of an MSP package
            _ba.PlanTargetMsiPackage += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "PlanTargetMsiPackage");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageId: {0}", e.PackageId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProductCode: {0}", e.ProductCode));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    State: {0}", e.State));
            };

            // Fired when the engine has changed progress for the bundle installation
            _ba.Progress += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "Progress");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    OverallPercentage: {0}", e.OverallPercentage));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    ProgressPercentage: {0}", e.ProgressPercentage));
            };

            // Fired when the engine has begun registering the location and visibility of the bundle
            _ba.RegisterBegin += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "RegisterBegin");

            // Fired when the engine has begun completed the location and visibility of the bundle
            _ba.RegisterComplete += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "RegisterComplete");

            // Fired by the engine to allow the user experience to change the source using Engine.SetLocalSource or Engine.SetDownloadSource
            _ba.ResolveSource += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "ResolveSource");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    DownloadSource: {0}", e.DownloadSource));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    LocalSource: {0}", e.LocalSource));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PackageOrContainerId: {0}", e.PackageOrContainerId));
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    PayloadId: {0}", e.PayloadId));
            };

            // Fired by the engine to request a restart now or inform the user a manual restart is required later
            _ba.RestartRequired += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "RestartRequired");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Restart: {0}", e.Restart));
            };

            // Fired when the engine is shutting down the bootstrapper application
            _ba.Shutdown += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "Shutdown");

            // Fired when the engine is starting up the bootstrapper application
            _ba.Startup += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "Startup");

            // Fired when the system is shutting down or user is logging off
            _ba.SystemShutdown += (s, e) =>
            {
                _ba.Engine.Log(LogLevel.Verbose, "SystemShutdown");
                _ba.Engine.Log(LogLevel.Verbose, string.Format("    Reasons: {0}", e.Reasons));
            };

            // Fired when the engine has begun removing the registration for the location and visibility of the bundle
            _ba.UnregisterBegin += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "UnregisterBegin");

            // Fired when the engine has completed removing the registration for the location and visibility of the bundle
            _ba.UnregisterComplete += (s, e) => _ba.Engine.Log(LogLevel.Verbose, "UnregisterComplete");

            #endregion
#endif
        }
 public void Initialize(BootstrapperApplication bootstrapper, AutoResetEvent autoEvent)
 {
     this.Bootstrapper = bootstrapper;
     this.Bootstrapper.Error += this.OnError;
     this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
     this.Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
     this.Bootstrapper.DetectComplete += this.OnDetectComplete;
     this.Bootstrapper.PlanComplete += this.OnPlanComplete;
     this.Bootstrapper.PlanPackageComplete += this.OnPlanPackageComplete;
     this.autoEvent = autoEvent;
     this.Bootstrapper.Engine.Detect();
 }
		public InstallerMainWindowViewModel(BootstrapperApplication bootstrapper, Engine engine)
		{
			this.bootstrapper = bootstrapper;
			this.engine = engine;

			// For demo purposes, we set two variables here. They are passed on to the chained MSIs.
			engine.StringVariables["Prerequisite"] = "1";
			engine.StringVariables["InstallLevel"] = "100";

			// Setup commands
			this.InstallCommandValue = new DelegateCommand(
				() => engine.Plan(LaunchAction.Install),
				() => !this.Installing && this.State == InstallationState.DetectedAbsent);
			this.UninstallCommandValue = new DelegateCommand(
				() => engine.Plan(LaunchAction.Uninstall),
				() => !this.Installing && this.State == InstallationState.DetectedPresent);

			// Setup event handlers
			bootstrapper.DetectBegin += (_, ea) =>
				{
					this.LogEvent("DetectBegin", ea);

					// Set installation state that controls the install/uninstall buttons
					this.interactionService.RunOnUIThread(
						() => this.State = ea.Installed ? InstallationState.DetectedPresent : InstallationState.DetectedAbsent);
				};
			bootstrapper.DetectRelatedBundle += (_, ea) =>
				{
					this.LogEvent("DetectRelatedBundle", ea);

					// Save flag indicating whether this is a downgrade operation
					this.interactionService.RunOnUIThread(() => this.Downgrade |= ea.Operation == RelatedOperation.Downgrade);
				};
			bootstrapper.DetectComplete += (s, ea) =>
				{
					this.LogEvent("DetectComplete");
					this.DetectComplete(s, ea);
				};
			bootstrapper.PlanComplete += (_, ea) =>
				{
					this.LogEvent("PlanComplete", ea);

					// Start apply phase
					if (ea.Status >= 0 /* Success */)
					{
						this.engine.Apply(this.interactionService.GetMainWindowHandle());
					}
				};
			bootstrapper.ApplyBegin += (_, ea) =>
				{
					this.LogEvent("ApplyBegin");

					// Set flag indicating that apply phase is running
					this.interactionService.RunOnUIThread(() => this.Installing = true);
				};
			bootstrapper.ExecutePackageBegin += (_, ea) =>
				{
					this.LogEvent("ExecutePackageBegin", ea);

					// Trigger display of currently processed package
					this.interactionService.RunOnUIThread(() => this.CurrentPackage = ea.PackageId);
				};
			bootstrapper.ExecutePackageComplete += (_, ea) =>
				{
					this.LogEvent("ExecutePackageComplete", ea);

					// Remove currently processed package
					this.interactionService.RunOnUIThread(() => this.CurrentPackage = string.Empty);
				};
			bootstrapper.ExecuteProgress += (_, ea) =>
			{
				this.LogEvent("ExecuteProgress", ea);

				// Update progress indicator
				this.interactionService.RunOnUIThread(() =>
				{
					this.LocalProgress = ea.ProgressPercentage;
					this.GlobalProgress = ea.OverallPercentage;
				});
			};
			bootstrapper.ApplyComplete += (_, ea) =>
				{
					this.LogEvent("ApplyComplete", ea);

					// Everything is done, let's close the installer
					this.interactionService.CloseUIAndExit();
				};
		}
Esempio n. 22
0
File: Model.cs Progetto: zooba/wix3
 /// <summary>
 /// Creates a new model for the UX.
 /// </summary>
 /// <param name="bootstrapper">Bootstrapper hosting the UX.</param>
 public Model(BootstrapperApplication bootstrapper)
 {
     this.Bootstrapper = bootstrapper;
     this.Telemetry = new List<KeyValuePair<string, string>>();
 }
Esempio n. 23
0
 public FiresecUXModel(BootstrapperApplication bootstrapper)
 {
     Bootstrapper = bootstrapper;
     Telemetry = new List<KeyValuePair<string, string>>();
 }
Esempio n. 24
0
 //private readonly Dispatcher _dispatcher;
 public BaseModel(BootstrapperApplication bootstrapper)
 {
     _bootstrapper = bootstrapper;
 }
 /// <summary>
 /// Creates a new model for the UX.
 /// </summary>
 /// <param name="bootstrapper">Bootstrapper hosting the UX.</param>
 public Model(BootstrapperApplication bootstrapper)
 {
     Bootstrapper = bootstrapper;
 }
Esempio n. 26
0
        //constructor
        public MainViewModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;

            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
            this.Bootstrapper.DetectPackageComplete += this.OnDetectPackageComplete;
            this.Bootstrapper.PlanComplete += this.OnPlanComplete;
            this.Bootstrapper.ExecuteMsiMessage += OnExecuteMessage;
        }
Esempio n. 27
0
 public MainView(BootstrapperApplication bootstrapper)
 {
     InitializeComponent();
     DataContext =
     viewModel = new MainViewModel(bootstrapper);
 }