Example #1
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;
        }