/* * METHOD : disconnectionServerFieldsFormattingEvents() * * DESCRIPTION : A series of formating events are triggerd * which update GUI for user status of disconnection. * * PARAMETERS : * * RETURNS : N/A */ public void disconnectionServerFieldsFormattingEvents() { SendButton.IsEnabled = false; DisconnectedButton.IsEnabled = true; checkUserName.IsEnabled = true; ClearButton1.IsEnabled = true; checkServerName.IsEnabled = true; DisconnectButton.IsEnabled = false; userNameSelected = false; ConnectedButton.IsEnabled = false; ServerNameTextBox.IsReadOnly = false; userNameTextBox.IsReadOnly = false; selectAllButton.IsEnabled = false; selectButton.IsEnabled = false; Deselect.IsEnabled = false; ServerNameTextBox.Background = SystemColors.WindowBrush; userNameTextBox.Background = SystemColors.WindowBrush; ServerNameTextBox.Foreground = Brushes.Black; userNameTextBox.Foreground = Brushes.Black; userNameTextBox.Clear(); ServerNameTextBox.Clear(); // ServerNameTextBox.TextAlignment = TextAlignment.Left; userNameTextBox.TextAlignment = TextAlignment.Left; userNameTextBox.Focus(); }
/* * EVENT : ServerNameTextBox_TextChanged() * * DESCRIPTION : This method is as a safegaurd/validator for the servername (machine name) to not * contain any of the same characters as packet message. As empty space, |, and , all * are used as delimiters for packet message. * * PARAMETERS : object : sender * : RoutedEventArgs : e * * RETURNS : N/A */ private void ServerNameTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (ServerNameTextBox.Text.Contains(" ")) { MessageBox.Show("No ' spaces ' in user name."); ServerNameTextBox.Clear(); ServerNameTextBox.Focus(); } else if (ServerNameTextBox.Text.Contains("|")) { MessageBox.Show("No ' | ' in user name."); ServerNameTextBox.Clear(); ServerNameTextBox.Focus(); } else if (ServerNameTextBox.Text.Contains(",")) { MessageBox.Show("No ' , ' in user name."); ServerNameTextBox.Clear(); ServerNameTextBox.Focus(); } }