Пример #1
0
 private static void connect(string ip, int port)
 {
     gpshelper = new SensorXeGpsHelper(ip, port);
     gpshelper.ReciveGpsData           += gpshelper_ReciveGpsData;
     gpshelper.ServerConnected         += gpshelper_ServerConnected;
     gpshelper.ServerDisconnected      += gpshelper_ServerDisconnected;
     gpshelper.ServerExceptionOccurred += gpshelper_ServerExceptionOccurred;
     gpshelper.Connect();
 }
Пример #2
0
 public static void CloseGps()
 {
     if (!IsOpenGps)
     {
         return;
     }
     IsOpenGps = false;
     if (dataInvokers != null)
     {
         foreach (var invoker in dataInvokers)
         {
             invoker.Stop();
         }
     }
     if (gpshelper != null)
     {
         gpshelper.Close();
         gpshelper.ReciveGpsData           -= gpshelper_ReciveGpsData;
         gpshelper.ServerConnected         -= gpshelper_ServerConnected;
         gpshelper.ServerDisconnected      -= gpshelper_ServerDisconnected;
         gpshelper.ServerExceptionOccurred -= gpshelper_ServerExceptionOccurred;
     }
     gpshelper = null;
 }