예제 #1
0
 private void ClientNameField_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         e.SuppressKeyPress = true;
         SetUsername();
         ConnectButton.Focus();
     }
 }
예제 #2
0
        /// <summary>
        /// When the program starts, this function is called.
        /// It gets the serial number of the first connected Jrk,
        /// since this is probably what you want to connect to.
        /// </summary>
        void MainWindow_Shown(object sender, EventArgs e)
        {
            var deviceList = Jrk.getConnectedDevices();

            if (deviceList.Count > 0)
            {
                SerialNumberTextBox.Text = deviceList[0].serialNumber;
                ConnectButton.Focus();
            }
            else
            {
                SerialNumberTextBox.Focus();
            }
        }
예제 #3
0
        private void TextBox_KeyUp(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == Windows.System.VirtualKey.Enter)
            {
                switch (((Control)sender).Name)
                {
                case "Password":
                    ConnectButton.Focus(FocusState.Pointer);
                    ConnectButton_Click(sender, null);
                    break;

                default:
                    break;
                }
            }
        }