예제 #1
0
 /// <summary>
 /// Dispose any instanciated classes and clear any provate variables used
 /// </summary>
 public void Dispose()
 {
     if (IsRunning)
     {
         Stop();
     }
     fsConnector?.Dispose();
     listener?.Dispose();
     listener = null;
     endPoint = null;
     requestResults?.Clear();
     requestResults = null;
     fsConnector    = null;
 }
예제 #2
0
 /// <summary>
 /// Check to see if MSFS2020 is running, if running, instantiate SimConnect communication
 /// </summary>
 private void StartConnector()
 {
     try
     {
         fsConnector                        = new FSConnector();
         fsConnector.LogReceived           += WriteLog;
         fsConnector.DataReceived          += MessageReceived;
         fsConnector.ConnectionStateChange += ConnectionStateChanged;
         fsConnector.Start();
         _updateFrequency = fsConnector.ValueRequestInterval;
         requestResults.First(x => x.Request.Name == "UPDATE FREQUENCY" && x.Request.Unit == "millisecond").Value = _updateFrequency;
     }
     catch (Exception ex)
     {
         WriteLog(ex);
     }
 }