private void ArchiveDirSelect_Click(object sender, EventArgs e) { folderBrowserDialog.ShowNewFolderButton = true; DialogResult result = folderBrowserDialog.ShowDialog(); if (result == DialogResult.OK) { archiveDirTextBox.Text = folderBrowserDialog.SelectedPath; TextValidator.IsValidDirectory(archiveDirTextBox, toolTip, "Please provide a valid archive directory"); } }
private void IsFormValid() { bool validationResult = true; if (!TextValidator.IsValidDirectory(localDirTextBox, toolTip, "Please provide a valid local directory")) { validationResult = false; } if (archive.Checked) { if (!TextValidator.IsValidDirectory(archiveDirTextBox, toolTip, "Please provide a valid archive directory")) { validationResult = false; } } if (timeRotate.Checked) { if (!TextValidator.IsValidInteger(minutesTextBox, toolTip, "Please provide the number of minutes in whole digits")) { validationResult = false; } } if (sizeRotate.Checked) { if (!TextValidator.IsValidInteger(MBtextBox, toolTip, "Please provide a MB value in whole digits")) { validationResult = false; } } // If we are logging locally we don't need any more than this if (!logLocally.Checked) { if (!TextValidator.IsValidHost(remoteHostTextBox, toolTip, "This does not appear to be a valid remote host (we cannot ping it)")) { validationResult = false; } if (!TextValidator.IsValidInteger(remotePortTextBox, toolTip, "This does not appear to be a valid remote port")) { validationResult = false; } if (!TextValidator.IsValidText(remoteDirTextBox, toolTip, "Please provide a valid remote directory")) { validationResult = false; } if (!TextValidator.IsValidText(usernameTextBox, toolTip, "Please provide a valid username")) { validationResult = false; } if (!TextValidator.IsValidText(passwordTextBox, toolTip, "Please provide a valid password")) { validationResult = false; } } if (!limitArchive.Checked) { if (!TextValidator.IsValidInteger(ArchiveLimitTextBox, toolTip, "Please provide a number of files to retain in whole digits")) { validationResult = false; } } isFormValid = validationResult; UpdateDataLoggerConfig(); UpdateButtons(); }