コード例 #1
0
 public void MonitorGPS(Object sender, ElapsedEventArgs eventArgs)
 {
     if (!_gpsMgr.IsConnected)
     {
         _gpstimer.Stop();
         try
         {
             Tracing?.TraceEvent(TraceEventType.Information, 0, "GPS not connected so connecting...");
             _gpsMgr.StartRecording();
             Tracing?.TraceEvent(TraceEventType.Information, 0, "GPS connected");
             _gpstimer.Interval = 10000;
         }
         catch (Exception e)
         {
             Tracing?.TraceEvent(TraceEventType.Error, 0, "MontiorGPS: {0}", e.Message);
         }
         finally
         {
             _gpstimer.Start();
         }
     }
 } //end timer monitor GPS device connedted