private bool IsTextBoxValid(TextBox textBox) { // Check if this textBox is enabled? if (textBox.Enabled) { // Check if we have any text? if (!String.IsNullOrEmpty(textBox.Text) && !MOG_ControllerSystem.InvalidWindowsPathCharactersCheck(textBox.Text, true)) { // Color us green textBox.BackColor = Color.PaleGreen; return(true); } else { // Color us red textBox.BackColor = Color.Tomato; } } else { // Color us red textBox.BackColor = Color.LightGray; } return(false); }
private void UpdateLocalTargetTextBox() { NewLocalTargetTextBox.BackColor = Color.Tomato; // Check if there is anything in there yet? if (NewLocalTargetTextBox.Text.Length > 0) { // Lets make sure that the selected target has a path root and at least one directory // Make sure this path is rooted if (!MOG_ControllerSystem.InvalidWindowsPathCharactersCheck(NewLocalTargetTextBox.Text, true) && Path.IsPathRooted(NewLocalTargetTextBox.Text)) { NewLocalTargetTextBox.BackColor = Color.PaleGreen; } } }
private void UpdateNewWorkspaceDirectoryTextBox() { NewWorkspaceDirectoryTextBox.BackColor = Color.Tomato; if (NewWorkspaceDirectoryTextBox.Text.Length > 0) { // Lets make sure that the selected target has a path root and at least one directory // Make sure this path is rooted if (!MOG_ControllerSystem.InvalidWindowsPathCharactersCheck(NewWorkspaceDirectoryTextBox.Text, true) && Path.IsPathRooted(NewWorkspaceDirectoryTextBox.Text)) { NewWorkspaceDirectoryTextBox.BackColor = Color.PaleGreen; } } // Check if the user can continue? NewWorkspaceWizard.NextEnabled = (NewWorkspaceDirectoryTextBox.BackColor == Color.Tomato) ? false : true; }