Ejemplo n.º 1
0
        private void btnUpdateMyClientConfig_Click(object sender, EventArgs e)
        {
            if (chkUseAutoLogon.Checked && (txtAutoLogonUser.Text == String.Empty))
            {
                string msg = "If you want to use the Auto-Logon capability, you must supply a Username.";
                MessageBox.Show(msg, Program.APP_TITLE);
                txtAutoLogonUser.Focus();
                return;
            }

            ClientAutoLogOn calo = new ClientAutoLogOn(BranchLocation);

            // Validate the format of the action text
            string[] sep =
            {
                "\r\n"
            };
            string[] items = txtAutoLogonAction.Text.Split(sep, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < items.Length; i++)
            {
                items[i].Trim();
            }

            string s = String.Empty;

            for (int i = 0; i < items.Length; i++)
            {
                if (items[i] != String.Empty)
                {
                    if (s != String.Empty)
                    {
                        s += ",";
                    }

                    s += items[i];
                }
            }

            if (calo.UpdateConfig(chkUseAutoLogon.Checked, txtAutoLogonUser.Text, txtAutoLogonPW.Text, s))
            {
                // Now we will run the InitConfigFiles task, which copies the new file ready for running the client
                // By doing it here users will see the effect of their changes if they run direct from the IDE as opposed to using this app to start the client
                if (RunInitConfigFiles())
                {
                    MessageBox.Show("The update was applied successfully.", Program.APP_TITLE);
                }
                else
                {
                    MessageBox.Show(
                        @"The update was applied successfully to \inc\Template\etc\Client.config.my, but an error occurred in running the InitConfigFiles task.",
                        Program.APP_TITLE);
                }
            }
        }
Ejemplo n.º 2
0
        private void btnResetClientConfig_Click(object sender, EventArgs e)
        {
            string msg =
                "This action will reset all your client options (and not simply the startup options) because it will overwrite your personal copy of your entire ";

            msg += "client configuration with the latest version from the source code repository.  ";
            msg += "Usually this is a good thing because the repository copy may contain enhancements that your current personal copy is lacking.  ";
            msg += "You may notice changes in the behaviour of your client application as a result of this action.\r\n\r\n";
            msg += "Do you want to proceed?";

            if (MessageBox.Show(msg, Program.APP_TITLE, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            ClientAutoLogOn calo = new ClientAutoLogOn(BranchLocation);

            if (!calo.ResetConfig())
            {
                return;
            }

            SetBranchDependencies();

            if (!RunInitConfigFiles())
            {
                msg =
                    @"Your configuration was reset successfully in \inc\Template\etc\Client.config.my, but an error occurred in running the InitConfigFiles task.  ";
                msg += "This will mean that the Open Petra Client may not rspond correctly to your changes.";
                MessageBox.Show(msg, Program.APP_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 3
0
        private void SetBranchDependencies()
        {
            lblBranchLocation.Text = (BranchLocation == String.Empty) ? "Not defined" : BranchLocation;

            BuildConfiguration dbCfg = new BuildConfiguration(BranchLocation, _localSettings);

            if (BranchLocation == String.Empty)
            {
                lblDbBuildConfig.Text = "";
                lblDatabaseName.Text = "None";
            }
            else
            {
                lblDbBuildConfig.Text = dbCfg.CurrentConfig;
                lblDatabaseName.Text = dbCfg.CurrentDBName;
            }

            dbCfg.ListAllConfigs(listDbBuildConfig);        // This might add a new configuration, so we need to update our local settings
            _localSettings.DbBuildConfigurations = dbCfg.FavouriteConfigurations;
            btnRemoveDbBuildConfig.Enabled = listDbBuildConfig.Items.Count > 0;
            btnEditDbBuildConfig.Enabled = listDbBuildConfig.Items.Count > 0;
            btnSaveDbBuildConfig.Enabled = listDbBuildConfig.Items.Count > 0 && BranchLocation != String.Empty;

            if (BranchLocation == String.Empty)
            {
                txtAutoLogonUser.Text = String.Empty;
                txtAutoLogonPW.Text = String.Empty;
                txtAutoLogonAction.Text = String.Empty;
                chkUseAutoLogon.Checked = false;
                chkUseAutoLogon.Enabled = false;
            }
            else
            {
                ClientAutoLogOn calo = new ClientAutoLogOn(BranchLocation);
                txtAutoLogonUser.Text = calo.UserName;
                txtAutoLogonPW.Text = calo.Password;
                txtAutoLogonAction.Text = calo.TestAction.Replace(",", "\r\n");
                chkUseAutoLogon.Checked = (txtAutoLogonUser.Text != String.Empty);
                chkUseAutoLogon.Enabled = true;
            }
        }