コード例 #1
0
        private void SetupControls()
        {
            ServerNameTextBox.Focus();
            PasswordBox.PasswordChanged += (sender, args) => { OnPropertyChanged(IsValidPropertyName); };
            Authentication = WindowsAuthentication;

            IsVisibleChanged += (sender, args) =>
            {
                if (!IsVisible)
                {
                    return;
                }

                //activate wpf window. see http://stackoverflow.com/questions/257587/bring-a-window-to-the-front-in-wpf
                Activate();
                Topmost = true;                  // important
                Topmost = false;                 // important
                Focus();

                //set focus on textbox. see http://stackoverflow.com/questions/13955340/keyboard-focus-does-not-work-on-text-box-in-wpf
                Dispatcher.BeginInvoke(DispatcherPriority.Input,
                                       new Action(() =>
                {
                    ServerNameTextBox.Focus();                             // Set Logical Focus
                    Keyboard.Focus(ServerNameTextBox);                     // Set Keyboard Focus
                }));
            };
        }
コード例 #2
0
 /*
  * EVENT : client_button_Click()
  *
  * DESCRIPTION : This event is activated when user inputs a
  * client name. If the user name is not activated it will trigger a series of
  * formatting events to the GUI.
  * PARAMETERS : object : sender
  *            : RoutedEventArgs : e
  *
  * RETURNS    : N/A
  */
 private void client_button_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(userNameTextBox.Text))
     {
         userNameConnectionFormatingEvents();
         ServerNameTextBox.Focus();
     }
     else
     {
         MessageBox.Show("Please input a proper user name (Ex: JohnnyUtah30)");
     }
 }
コード例 #3
0
        public Settings(double WindowLeft, double WindowTop)
        {
            InitializeComponent();

            DataContext = App.Settings;

            ServerNameTextBox.Focus();

            // Window position
            Left = WindowLeft + 20;
            Top  = WindowTop + 20;
        }
コード例 #4
0
 /*
  * 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();
     }
 }
コード例 #5
0
        private void ClearButton_Click(object sender, EventArgs e)
        {
            //Form title is changed to "Welcome to Sult".
            this.Text = "Welcome to Sult";

            //Hiding the controls that are to be hidden from the user.
            PizzaMenuGroupBox.Visible      = false;
            OrderSummaryGroupBox.Visible   = false;
            LogoPictureBox.Visible         = false;
            CompanySummaryGroupBox.Visible = false;
            OrderPanel.Visible             = false;

            //showing Start butten Panel
            StartPanel.Visible = true;

            ServerNameTextBox.Text = "";
            TableNoTextBox.Text    = "";

            MargheritaPizzaQuantityTextBox.Text = "0";
            PepperoniPizzaQuanityTextBox.Text   = "0";
            HamPineappleQuantityTextBox.Text    = "0";

            ServerNameTextBox.Focus();
        }