示例#1
0
        // Configuration Dialog...
        private void LoadConfigurationDialog()
        {
            string s = string.Empty;
            ConfigForm configDialog = new ConfigForm();

            // Copy the current settings into the Configuration form...
            configDialog.appSettings = appSettings;
            configDialog.StartPosition = FormStartPosition.CenterParent;

            if (configDialog.ShowDialog(this) == DialogResult.OK) s = "OK";
            else s = "Cancel";

            // Copy settings...
            appSettings = configDialog.appSettings;

            configDialog.Dispose();
        }
示例#2
0
        private bool ValidateAppSettings(AppSettings appSettings)
        {
            if (Helper.AppSettingsEmptyOrNull(appSettings))
                // Invalid
                return false;

            // If we get here, there is data in appSettings...
            // Validate the data using the existing ConfigForm validation code...

            // Verify the ExePath...
            if (!Directory.Exists(appSettings.ExePath))
            {
                appSettings.ExePath = null;
                // Invalid
                return false;
            }

            // NOTE: We are not going to show the form. We are only going to use the
            //		 validation code.
            ConfigForm configFormDialog = new ConfigForm();
            configFormDialog.appSettings = appSettings;
            configFormDialog.ConfigForm_Load(null, null);

            // ValidateConfigForm return: True = valid || False = invalid;
            bool isValid = configFormDialog.ValidateConfigForm();

            // Make sure the form object is completely cleaned up...
            configFormDialog.Close();
            configFormDialog.Dispose();

            // true = invalid || false = valid
            return isValid;
        }
示例#3
0
        private void InitControls()
        {
            if (!ValidateAppSettings(appSettings))
            {
                ConfigForm configFormDialog = new ConfigForm();

                // Copy the current settings into the Configuration form...
                configFormDialog.appSettings = appSettings;
                configFormDialog.StartPosition = FormStartPosition.CenterParent;
                configFormDialog.Text = "Push Application Setup";

                if (configFormDialog.ShowDialog(this) == DialogResult.Cancel)
                {
                    // If we get here, exit the application imeadiatly...
                    this.Close();
                    return;
                }

                // Copy settings...
                appSettings = configFormDialog.appSettings;

                configFormDialog.Dispose();
            }

            // Build the Ignore File regular expression pattern...
            ignorePattern = BuildIgnorePattern();

            // Init Controls...
            lblStatus1_1.Text = string.Empty;
            lblStatus1_2.Text = string.Empty;
            lblStatus2_2.Text = string.Empty;

            lblStatus1_1.Visible = false;
            lblStatus1_2.Visible = false;
            lblStatus2_2.Visible = false;

            toolStripProgressBar.Visible = false;
            toolStripLblProgress.Visible = false;

            // Update the form properties to the last used...
            UpdateControls();
        }