コード例 #1
0
 //W przypadku gdy okno ComPort zostało zamknięte kasuje odniesienie do niego w głównym oknie
 private void ComPortWindowClosed(object sender, WindowClosedEventArgs e)
 {
     if (comPort != null)
     {
         comPort.WindowClosed -= ComPortWindowClosed;
         comPort = null;
         AddToLog("Communication Port window closed.");
     }
 }
コード例 #2
0
 //Uruchamia okno Communication Port lub jeżeli jest ono uruchomione aktywuje je
 private void CommunicationPortButton_Click(object sender, RoutedEventArgs e)
 {
     if (comPort is null)
     {
         comPort = new CommunicationPort(data);
         comPort.WindowClosed += ComPortWindowClosed;
         comPort.UpdateData   += DataUpdated;
         comPort.Show();
         AddToLog("Communication Port window opened.");
     }
     else
     {
         comPort.Activate();
     }
 }