Beispiel #1
0
 /// <summary>
 /// 关闭系统
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEnd_Click(object sender, RoutedEventArgs e)
 {
     SPComCall.Close();
     if (!SPComCall.IsOpen)
     {
         imgCOM.Source          = new BitmapImage(new Uri("pack://application:,,,/Image/Light_Close_24.png"));
         lblcomstate.Content    = "关闭";
         lblcomstate.Foreground = Brushes.Red;
     }
     lblsystemstate.Content    = "关闭";
     lblsystemstate.Foreground = Brushes.Red;
     imgSystem.Source          = new BitmapImage(new Uri("pack://application:,,,/Image/Light_Close_24.png"));
     btnStart.IsEnabled        = true;
     btnEnd.IsEnabled          = false;
 }
 /// <summary>
 /// Execute shutdown tasks
 /// </summary>
 /// <param name="sender">Object sending the event</param>
 /// <param name="e">Event arguments</param>
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     // Stop Com,Unregister SPComCall data received event
     if (null != SPComCall)
     {
         SPComCall.Close();
         SPComCall.OnDataReceived -= this.SPComCall_OnDataReceived;
     }
     if (null != buf_callsend)
     {
         buf_callsend = null;
     }
     if (null != buf_callrec)
     {
         buf_callrec = null;
     }
 }