示例#1
0
        public void RunInstall()
        {
            var progressBar = FindControlByName.FindChild <ProgressBar>(Application.Current.MainWindow, "InstallProgressBar");
            var steps       = SetupInfo.GetValue <ObservableCollection <Node> >(SetupInfoKeys.NodeList).Count * 5;

            this.progress_step = Convert.ToInt32((progressBar.Maximum / steps));
            SynchronizationContext sc = SynchronizationContext.Current;
            var t = Task.Run(() =>
            {
                var installer = InstallerFactory.GetGammaServiceSetup();
                installer.OnOpCompletedEventHandler += (s, e) => {
                    sc.Post((obj) => {
                        ResultText        += string.Format("--------------------\n{0}\n{1}\n{2}\n", e.Hostname, e.OpType, e.OpResult);
                        progressBar.Value += this.progress_step;
                    }, null);
                };
                return(installer.AllInOne());
            });

            t.GetAwaiter().OnCompleted(() => {
                progressBar.Value = 100;
                RaiseFinishInstallEvent(null);
                ResultText += "\n===========FINISHED===============\n";
            });
        }
示例#2
0
        /// <summary>
        /// Deletes the given mod.
        /// </summary>
        /// <remarks>
        /// The mod is deactivated, unregistered, and then deleted.
        /// </remarks>
        /// <param name="p_modMod">The mod to delete.</param>
        /// <param name="p_rolActiveMods">The list of active mods.</param>
        /// <returns>A background task set allowing the caller to track the progress of the operation,
        /// or <c>null</c> if no long-running operation needs to be done.</returns>
        public IBackgroundTaskSet DeleteMod(IMod p_modMod, ReadOnlyObservableList <IMod> p_rolActiveMods)
        {
            ModDeleter mddDeleter = InstallerFactory.CreateDelete(p_modMod, p_rolActiveMods);

            mddDeleter.TaskSetCompleted += new EventHandler <TaskSetCompletedEventArgs>(Deactivator_TaskSetCompleted);
            mddDeleter.Install();
            return(mddDeleter);
        }
示例#3
0
        /// <summary>
        /// deactivates the given mod.
        /// </summary>
        /// <param name="p_modMod">The mod to deactivate.</param>
        /// <param name="p_rolActiveMods">The list of active mods.</param>
        /// <returns>A background task set allowing the caller to track the progress of the operation.</returns>
        public IBackgroundTaskSet DeactivateMod(IMod p_modMod, ReadOnlyObservableList <IMod> p_rolActiveMods)
        {
            if (!InstallationLog.ActiveMods.Contains(p_modMod))
            {
                return(null);
            }
            ModUninstaller munUninstaller = InstallerFactory.CreateUninstaller(p_modMod, p_rolActiveMods);

            munUninstaller.Install();
            return(munUninstaller);
        }
示例#4
0
        public override void Init(System.Web.Mvc.ControllerBuilder controllerBuilder)
        {
            InstallerFactory installerFactory = new InstallerFactory();

            var repositoriesInstaller = installerFactory.CreateInstance(typeof(RepositoriesInstaller));
            var componentInstaller    = installerFactory.CreateInstance(typeof(ComponentsInstaller));
            var controllersInstaller  = installerFactory.CreateInstance(typeof(ControllersInstaller));

            IWindsorInstaller[] installers = { repositoriesInstaller, componentInstaller, controllersInstaller };

            container = new WindsorContainer()
                        .Install(installers);

            var controllerFactory = new WindsorControllerFactory(container.Kernel);

            controllerBuilder.SetControllerFactory(controllerFactory);
        }
//		public InstallersDirectory(string dir):this()
//		{
//
//			this.Directory = dir;
//			ProcessDirectory();
//
//		}
        void AddInstaller(String fileName)
        {
            BackgroundWorker bw_add_installer = new BackgroundWorker();

            bw_add_installer.DoWork += delegate(object sender, DoWorkEventArgs e)
            {
                IInstaller inst = null;
                try{
                    inst = InstallerFactory.GetInstaller(fileName);
                    if (inst != null)
                    {
                        e.Result = inst;
                    }
                    else
                    {
                        e.Result = null;
                    }
                }catch (Exception)
                {
                    e.Result = null;
                }
            };
            bw_add_installer.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e)
            {
                if (!e.Cancelled && e.Result != null && e.Result is IInstaller)
                {
                    try{
                        IInstaller inst = (IInstaller)e.Result;
                        if (inst != null)
                        {
                            this.Installers.Add(inst);

                            App.Current.Dispatcher.Invoke((Action)(() => {
                            }));
                        }
                    }catch (Exception)
                    {
                    }
                }
            };
            bw_add_installer.RunWorkerAsync();
        }
        public DefaultInstallationStrategy(IMainAssemblyProvider mainAssemblyProvider,
                                           IPluginAssembliesProvider pluginAssembliesProvider, InstallerFactory installerFactory)
        {
            if (mainAssemblyProvider == null)
            {
                throw new ArgumentNullException(nameof(mainAssemblyProvider));
            }

            if (pluginAssembliesProvider == null)
            {
                throw new ArgumentNullException(nameof(pluginAssembliesProvider));
            }

            if (installerFactory == null)
            {
                throw new ArgumentNullException(nameof(installerFactory));
            }

            MainAssemblyProvider     = mainAssemblyProvider;
            PluginAssembliesProvider = pluginAssembliesProvider;
            InstallerFactory         = installerFactory;
        }
示例#7
0
 /// <summary>
 /// Sets the current profile manager.
 /// </summary>
 public void SetProfileManager(IProfileManager p_ipmProfileManager)
 {
     InstallerFactory.SetProfileManager(p_ipmProfileManager);
 }
 public ScenarioInstaller(Assembly assembly, InstallerFactory factory)
 {
     this.assembly = assembly;
     this.factory  = factory;
 }