Exemplo n.º 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";
            });
        }
Exemplo n.º 2
0
        public bool SaveContent()
        {
            bool rs          = true;
            var  passwordBox = FindControlByName.FindChild <PasswordBox>(Application.Current.MainWindow, "LogonPwdBox");

            if (passwordBox != null && Username != null && Domain != null && Username.Length != 0 && Domain.Length != 0)
            {
                Password = passwordBox.Password;
                if (Password != null)
                {
                    SetupInfo.SetValue(SetupInfoKeys.LogonUser, Username);
                    SetupInfo.SetValue(SetupInfoKeys.LogonDomain, Domain);
                    SetupInfo.SetValue(SetupInfoKeys.LogonPwd, Password);
                }
                else
                {
                    rs = false;
                }
            }
            else
            {
                MessageBox.Show("Pleaes check the input.");
                rs = false;
            }
            return(rs);
        }