コード例 #1
0
ファイル: DatabaseInstall.cs プロジェクト: kendadk/Installer
        private void Form_Load(object sender, EventArgs e)
        {
            try
            {
                regSettings = new RegistrySettings();
                regSettings.LoadCurrentValues();

                session.Log("Existing settings: DBPASSWORD " + regSettings.DbPassword + " DBUSERNAME " + regSettings.DbUsername + " DBPORT " + regSettings.DbPort + " DBCONNECTION " + regSettings.DbConnection);

                SetFormFields();

                if (regSettings.RequiredPresent())
                {
                    if (machine != "Client")
                    {
                        //Try to connect to MySql instance and check if osae database exists and if it needs to be upgraded
                        InstallStatus status = AttemptConnection();
                        if (status == InstallStatus.NEEDSUPGRADE)
                        {
                            upgrade();
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }
                        else if (status == InstallStatus.UPTODATE)
                        {
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            btnClose.Visible = true;
                            this.Close();
                        }
                    }
                    else
                    {
                        // the keys are present and we are doing a client install so nothing to do
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        btnClose.Visible = true;
                        this.Close();
                    }
                }

                if (machine == "Client")
                {
                    lb_Progress.Visible = false;
                    installationProgressBar.Visible = false;
                    txbUsername.Visible = false;
                    txbPassword.Visible = false;
                    txbWcfAddress.Visible = true;
                    usernameLabel.Visible = false;
                    passwordLabel.Visible = false;
                    WCFlabel.Visible = true;
                    label1.Text = "Please enter the server address and MySql port of your Open Source Automation server.";
                }
                else
                {
                    lb_Progress.Visible = true;
                    installationProgressBar.Visible = true;
                }
            }
            catch (Exception ex)
            {
                session.Log("Error occured in Form_Load details:" + ex.Message);
            }
        }
コード例 #2
0
        private void Form_Load(object sender, EventArgs e)
        {
            try
            {
                regSettings = new RegistrySettings();
                regSettings.LoadCurrentValues();

                session.Log("Existing settings: DBPASSWORD " + regSettings.DbPassword + " DBUSERNAME " + regSettings.DbUsername + " DBPORT " + regSettings.DbPort + " DBCONNECTION " + regSettings.DbConnection);

                SetFormFields();

                if (regSettings.RequiredPresent())
                {
                    if (machine != "Client")
                    {
                        //Try to connect to MySql instance and check if osae database exists and if it needs to be upgraded
                        InstallStatus status = AttemptConnection();
                        if (status == InstallStatus.NEEDSUPGRADE)
                        {
                            upgrade();
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }
                        else if (status == InstallStatus.UPTODATE)
                        {
                            this.DialogResult = System.Windows.Forms.DialogResult.OK;
                            btnClose.Visible  = true;
                            this.Close();
                        }
                    }
                    else
                    {
                        // the keys are present and we are doing a client install so nothing to do
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        btnClose.Visible  = true;
                        this.Close();
                    }
                }

                if (machine == "Client")
                {
                    lb_Progress.Visible             = false;
                    installationProgressBar.Visible = false;
                    txbUsername.Visible             = false;
                    txbPassword.Visible             = false;
                    txbWcfAddress.Visible           = true;
                    usernameLabel.Visible           = false;
                    passwordLabel.Visible           = false;
                    WCFlabel.Visible = true;
                    label1.Text      = "Please enter the server address and MySql port of your Open Source Automation server.";
                }
                else
                {
                    lb_Progress.Visible             = true;
                    installationProgressBar.Visible = true;
                }
            }
            catch (Exception ex)
            {
                session.Log("Error occured in Form_Load details:" + ex.Message);
            }
        }