private void HandShake_Click(object sender, RoutedEventArgs e)
 {
     HandshakeWindow handShakeWindow = new HandshakeWindow();
     Nullable<bool> dialogResult = handShakeWindow.ShowDialog();
     if((bool)dialogResult)
     {
         HandShake.IsEnabled = false;
         PlayBoardcast.IsEnabled = true;
     }
 }
Example #2
0
        private void HandShake_Click(object sender, RoutedEventArgs e)
        {
            HandshakeWindow handShakeWindow = new HandshakeWindow();
            Nullable <bool> dialogResult    = handShakeWindow.ShowDialog();

            if ((bool)dialogResult)
            {
                HandShake.IsEnabled     = false;
                PlayBoardcast.IsEnabled = true;
            }
        }
 public void HandShake()
 {
     // Configure the message box to be displayed
     string messageBoxText = "自检是否成功?";
     string caption = "自检结果";
     MessageBoxButton button = MessageBoxButton.YesNo;
     MessageBoxImage icon = MessageBoxImage.Warning;
     // Display message box
     MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon);
     // Process message box results
     switch (result)
     {
         case MessageBoxResult.Yes:
             // User pressed Yes button
             StateMachine.Fire(Triggers.HandShakeSucceeded);
             HandShakeState = 2;
             HandshakeWindow handShakeWindow = new HandshakeWindow();
             handShakeWindow.ShowDialog();
             TensionAdjust();
             break;
         case MessageBoxResult.No:
             // User pressed No button
             StateMachine.Fire(Triggers.HandShakeFailed);
             break;
     }
 }