Example #1
0
 void ConnectClicked()
 {
     if (flightBoardModel.IsConnect())
     {
         flightBoardModel.Stop();
         Commands.Instance.Init();
         System.Threading.Thread.Sleep(1000);
     }
     new Thread(delegate()
     {
         Commands.Instance.ServerConnect(ApplicationSettingsModel.Instance.FlightServerIP,
                                         ApplicationSettingsModel.Instance.FlightCommandPort);
     }).Start();
     flightBoardModel.Connect(ApplicationSettingsModel.Instance.FlightServerIP,
                              ApplicationSettingsModel.Instance.FlightInfoPort);
 }
Example #2
0
 private void OnDisconnectClick()
 {
     stop = true;
     //gracefully closing the connection and the info channel thread
     model.Stop();
     if (t.IsAlive)
     {
         if (t != Thread.CurrentThread)
         {
             t.Join();
         }
     }
     Debug.WriteLine("The thread of info channel has successfully finished");
     model.Disconnect();
     Debug.WriteLine("Successfully disconnected both channels");
 }