Exemple #1
0
        AdbTrackDevicesOperation CreateTracker()
        {
            LoggingService.LogInfo("Creating android device tracker");
            var trackerOp = new AdbTrackDevicesOperation();

            propTracker          = new DevicePropertiesTracker();
            propTracker.Changed += delegate {
                OnChanged(null, null);
            };
            trackerOp.DevicesChanged += delegate(List <AndroidDevice> list) {
                LoggingService.LogInfo("Got new device list from adb");
                Devices = list;
                OnChanged(null, null);
            };
            trackerOp.Completed += delegate(IAsyncOperation op) {
                var err = ((AdbTrackDevicesOperation)op).Error;
                if (err != null)
                {
                    LoggingService.LogError("Error in device tracker", err);
                    ClearTracking();
                }
            };
            Devices = trackerOp.Devices;
            return(trackerOp);
        }
Exemple #2
0
 void ClearTracking()
 {
     lock (lockObj) {
         if (op != null)
         {
             ((IDisposable)op).Dispose();
         }
         op = null;
         if (propTracker != null)
         {
             propTracker.Dispose();
         }
         propTracker = null;
         if (pop != null)
         {
             pop.Dispose();
         }
         pop           = null;
         Devices       = new AndroidDevice[0];
         lastForwarded = null;
         OnChanged(null, null);
     }
 }
		void ClearTracking ()
		{
			lock (lockObj) {
				if (op != null)
					((IDisposable)op).Dispose ();
				op = null;
				if (propTracker != null)
					propTracker.Dispose ();
				propTracker = null;
				Devices = new AndroidDevice[0];
				lastForwarded = null;
				OnChanged (null, null);
			}
		}
		AdbTrackDevicesOperation CreateTracker ()
		{
			var trackerOp = new AdbTrackDevicesOperation ();
			propTracker = new DevicePropertiesTracker ();
			propTracker.Changed += delegate {
				OnChanged (null, null);
			};
			trackerOp.DevicesChanged += delegate (List<AndroidDevice> list) {
				Devices = list;
				OnChanged (null, null);
			};
			trackerOp.Completed += delegate (IAsyncOperation op) {
				var err = ((AdbTrackDevicesOperation)op).Error;
				if (err != null) {
					LoggingService.LogError ("Error in device tracker", err);
					ClearTracking ();
				}
			};
			Devices = trackerOp.Devices;
			return trackerOp;
		}