示例#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
 public NodeListPageViewModel()
 {
     if (SetupInfo.HasKey(SetupInfoKeys.NodeList))
     {
         NodeList = SetupInfo.GetValue <ObservableCollection <Node> >(SetupInfoKeys.NodeList);
     }
     else
     {
         NodeList = new ObservableCollection <Node>();
     }
 }