private void textBoxFile_TextChanged(object sender, EventArgs e)
        {
            string error = null;
            bool   flag  = CheckPathValid(out error);

            if (!flag)
            {
                ctrlErrorLabel.Text    = error;
                ctrlErrorLabel.Visible = true;
                Wizard.SetWizardButtons(WizardButton.Back);
                return;
            }

            flag = CheckIsSupportedType(out error);
            if (!flag)
            {
                ctrlErrorLabel.Text    = error;
                ctrlErrorLabel.Visible = true;
                Wizard.SetWizardButtons(WizardButton.Back);
                return;
            }

            flag = CheckPathExists(out error);
            if (!flag)
            {
                ctrlErrorLabel.Text    = error;
                ctrlErrorLabel.Visible = true;
                Wizard.SetWizardButtons(WizardButton.Back);
                return;
            }

            ctrlErrorLabel.Text    = "";
            ctrlErrorLabel.Visible = true;
            Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
        }
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【安装来源】页面");
            if (isFirst)
            {
                isFirst = false;
                string startupPath = System.Windows.Forms.Application.StartupPath;
                string tmpPath     = startupPath + Path.DirectorySeparatorChar + Constants.DEFAULT_TMP_FILE_NAME + supportedXvaTypes;
                if (File.Exists(tmpPath))
                {
                    textBoxFile.Text = tmpPath;
                    textBoxFile.Select(0, 0);
                    Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
                }
                else
                {
                    Wizard.SetWizardButtons(WizardButton.Back);
                }
            }
            else
            {
                Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            }
            return(true);
        }
Example #3
0
 private void UpdateProgress(int progressPercent)
 {
     if (string.IsNullOrEmpty(HTTPHelper.errorInfo))
     {
         progressBar1.Value = progressPercent;
         label1.Text        = "正在导入,进度:" + progressPercent + "%";
         if (progressPercent >= 90)
         {
             label1.Text = HTTPHelper.progressInfo + ",进度:" + progressPercent + "%";
         }
         label1.Refresh();
         if (progressPercent == 100)
         {
             label1.Text = "安装完成:" + progressPercent + "%";
             label1.Refresh();
             Wizard.SetWizardButtons(WizardButton.Next);
             log.InfoFormat("WinCenter VM安装完成");
         }
     }
     else
     {
         //label1.Text = "安装失败:" + HTTPHelper.errorInfo;
         label1.Text = "安装失败,详情请查看日志!";
         label1.Refresh();
         importButton.Enabled = true;
         Wizard.SetWizardButtons(WizardButton.Back);
     }
 }
Example #4
0
        public void ConnFinished(string info)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new changeText(ConnFinished), info);
            }
            else
            {
                cmd.HideOpaqueLayer();
                if (Wizard != null)
                {
                    Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
                    if (!string.IsNullOrEmpty(info))
                    {
                        if (info.IndexOf("authenticate") > 0)
                        {
                            testConnectLabel.Text = "用户名或密码错误";
                        }
                        else
                        {
                            testConnectLabel.Text = info;
                        }
                    }

                    testConnectbutton.Enabled = true;
                    masterLabel.Visible       = masterTextBox.Visible = false;
                    if (ConnectManager.IsConn)
                    {
                        if (!IsTestConn)
                        {
                            foreach (WizardPage page in Wizard.m_pages)
                            {
                                if ("HostPage" == page.Name)
                                {
                                    Wizard.ActivatePage(Wizard.m_pages.IndexOf(page) + 1);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        string masterHostName = ConnectManager.MasterHostName;
                        if (!String.IsNullOrEmpty(masterHostName))
                        {
                            masterLabel.Visible     = masterTextBox.Visible = true;
                            this.ipBox1.BindTextBox = masterTextBox;
                            masterTextBox.Text      = masterHostName;
                            passwordTextBox.Text    = "";
                            testConnectLabel.Text   = "请输入管理节点用户密码!";
                        }
                    }
                }
            }
        }
Example #5
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("WinCenter安装向导开始,进入【欢迎】页面");
            Wizard.SetWizardButtons(WizardButton.Next);
            return(true);
        }
Example #6
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【安装虚拟机】页面");
            label1.Text = "";
            ShowData();
            Wizard.SetWizardButtons(WizardButton.Back);
            return(true);
        }
Example #7
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【网络配置】页面");
            InfoLabel.Text = "";
            getNetwork();
            Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            return(true);
        }
Example #8
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            string ip = "";

            ConnectManager.IPMaskGatewayDict.TryGetValue("ip", out ip);
            WinCenterLinkLabel.Text = winCenterLinkAddr = string.Format("https://{0}:8090/pc/index.jsp", ip);

            log.InfoFormat("进入【完成】页面");

            Wizard.SetWizardButtons(WizardButton.Finish);
            return(true);
        }
Example #9
0
        private void testConnectbutton_Click(object sender, EventArgs e)
        {
            if (!checkInput())
            {
                return;
            }

            testConnectbutton.Enabled = false;
            IsTestConn = true;
            Wizard.SetWizardButtons(WizardButton.Back);

            ThreadStart threadStart = new ThreadStart(DoConnect);
            Thread      thread      = new Thread(threadStart);

            thread.Start();

            cmd.ShowOpaqueLayer(panel1, 125, true);
        }
Example #10
0
        protected override string OnWizardNext()
        {
            if (!checkInput())
            {
                return(null);
            }

            IsTestConn = false;
            Wizard.SetWizardButtons(WizardButton.Back);

            ThreadStart threadStart = new ThreadStart(DoConnect);
            Thread      thread      = new Thread(threadStart);

            thread.Start();

            cmd.ShowOpaqueLayer(panel1, 125, true);
            return(null);
        }
Example #11
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【许可协议】页面");

            readRtfToRichTextBox();

            if (radioButton1.Checked)
            {
                Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            }
            else
            {
                Wizard.SetWizardButtons(WizardButton.Back);
            }
            return(true);
        }
Example #12
0
        private void importButton_Click(object sender, System.EventArgs e)
        {
            log.InfoFormat("开始安装WinCenter VM");
            if (!checkMemory())
            {
                return;
            }
            importButton.Enabled = false;
            Wizard.SetWizardButtons(WizardButton.DisabledAll);
            //注册关闭按钮事件
            Wizard.FormClosing  += new FormClosingEventHandler(FormClosing);
            HTTPHelper.errorInfo = "";

            Thread workThread = new Thread(new ThreadStart(ProcessImp));

            workThread.Start();

            Thread uiThread = new Thread(new ThreadStart(ChangeProgress));

            uiThread.Start();
        }
Example #13
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【主机配置】页面");

            testConnectbutton.Enabled = true;
            Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);

            //if (isFirst) {
            //    isFirst = false;
            //    testConnectbutton.Enabled = false;
            //    Wizard.SetWizardButtons(WizardButton.Back);
            //}
            //else {
            //    testConnectbutton.Enabled = true;
            //    Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            //}
            return(true);
        }
Example #14
0
 private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
 {
     Wizard.SetWizardButtons(WizardButton.Back);
 }
Example #15
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【存储配置】页面");
            SelectSRInfoLabel.Text = "";

            //ThreadStart threadStart = new ThreadStart(setVmName);
            //Thread thread = new Thread(threadStart);
            //thread.Start();

            string vdiSize = string.Format("{0:0.00}GB", ConnectManager.DiskCapacity / Constants.UINT);

            label1.Text = string.Format("所需磁盘容量为{0}, 请选择可用容量大于{1}的存储池", vdiSize, vdiSize);
            sROper      = new SROper();
            List <SRVo> srList = sROper.getSRByTargetHost();

            ////排序:降序
            //Reverser<SRVo> reverser = new Reverser<SRVo>(new SRVo().GetType(), "AvailableCapacity", ReverserInfo.Direction.DESC);
            //srList.Sort(reverser);
            ////排序
            //srList.Sort(delegate(SRVo x, SRVo y) { return x.AvailableCapacity.CompareTo(y.AvailableCapacity);});
            ////排序,使用Lambda表达式,升序
            //srList.Sort((x, y) => x.AvailableCapacity.CompareTo(y.AvailableCapacity));
            //排序,使用Lambda表达式,降序
            srList.Sort((x, y) => y.AvailableCapacity.CompareTo(x.AvailableCapacity));
            if (srList.Count > 0)
            {
                storageDataGridView.RowCount         = srList.Count;
                storageDataGridView.Rows[0].Selected = true;                //每次默认选中第一行
                for (int i = 0; i < srList.Count; i++)
                {
                    storageDataGridView.Rows[i].Cells["uuidColumn"].Value = srList[i].Uuid;
                    //int index = storageDataGridView.CurrentRow == null ? 0 : storageDataGridView.CurrentRow.Index;
                    int index = 0;
                    if (i == index)
                    {
                        storageDataGridView.Rows[i].Cells["checkBoxColumn"].Value = SelectedStatus.Selected;
                    }
                    else
                    {
                        storageDataGridView.Rows[i].Cells["checkBoxColumn"].Value = SelectedStatus.NoSelected;
                    }

                    storageDataGridView.Rows[i].Cells["nameLabelColumn"].Value         = srList[i].Name;
                    storageDataGridView.Rows[i].Cells["AvailableCapacityColumn"].Value = string.Format("{0:0.00}GB", srList[i].AvailableCapacity / Constants.UINT);
                    storageDataGridView.Rows[i].Cells["physicalSizeColumn"].Value      = string.Format("{0:0.00}GB", srList[i].PhysicalSize / Constants.UINT);
                    storageDataGridView.Rows[i].Cells["TypeColumn"].Value = srList[i].Type;
                    storageDataGridView.Rows[i].Cells["infoColumn"].Value = srList[i].Info;
                }
                //storageDataGridView.Sort(storageDataGridView.Columns["AvailableCapacityColumn"], ListSortDirection.Descending);
                Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            }
            else
            {
                Wizard.SetWizardButtons(WizardButton.Back);
            }

            return(true);
        }