Esempio n. 1
0
		private void NewDeviceFound(object sender, NewDeviceFoundEventArgs args)
		{
			try
			{
				Logger.TraceInfo("New device found: {0}", args.Device);
				_device = args.Device;
				_parentPath = Path.DirectorySeparatorChar + _device.FriendlyName;
				// H show names
				// C:\Users\curtis.CARVERLAB\Documents\onCoreMockData\bc971279-8c5e-4709-a0fe-e532d58fde82+hulu-b90acd07-a55f-4593-937d-fd7fb3679114.xml
				ParseIn("hulu-b90acd07-a55f-4593-937d-fd7fb3679114");

				var collection = AVItemCollections.FirstOrDefault(
					itemCollection => itemCollection.Title.Contains("Human Target"));

				if (collection == null)
					throw new InvalidOperationException("No collection found for Human Target");
				_parentPath = collection.Path;
				// Human Target episodes
				// C:\Users\curtis.CARVERLAB\Documents\onCoreMockData\bc971279-8c5e-4709-a0fe-e532d58fde82+hulu-b18846aa-c36f-45b9-b06c-d50f95ec64eb.xml
				ParseIn("hulu-b18846aa-c36f-45b9-b06c-d50f95ec64eb");

				// a single Human Target episode
				DetailItem.Add(AVItems[0]);

				_allDoneEvent.Set();
			}
			catch (Exception exception)
			{
				Logger.TraceErr(exception);
			}
		}
Esempio n. 2
0
		private static void GetDevice_OnNewDeviceFound(object sender, NewDeviceFoundEventArgs e)
		{
			if (e.Device.FriendlyName == _deviceName)
			{
				_deviceFound = e.Device;
				_allDoneEvent.Set();
			}
		}
		private void OnNewDeviceFound(object sender, NewDeviceFoundEventArgs e)
		{
			var sw = Utility.Watch();
			Logger.TraceInfo("Device: {0}, UserState: {1}", e.Device, e.UserState);
			try
			{
				if (ReplaceDevicesWhenFound)
				{
					if (Devices.Contains(e.Device))
					{
						SafeInvoke(() => Devices.Remove(e.Device));
					}
					if (AllDevices.Contains(e.Device))
					{
						SafeInvoke(() => AllDevices.Remove(e.Device));
					}
					SafeInvoke(() => Devices.Add(e.Device));
					SafeInvoke(() => AllDevices.Add(e.Device));
				}
				else
				{
					if (!Devices.Contains(e.Device))
					{
						SafeInvoke(() => Devices.Add(e.Device));
					}
					if (!AllDevices.Contains(e.Device))
					{
						SafeInvoke(() => AllDevices.Add(e.Device));
					}
				}

				if (IsWaitingForFirstDevice && AutoChooseFirstDevice)
				{
					// choose the first device...
					IsWaitingForFirstDevice = false;
					SelectDevice(e.Device, CancellationToken.None);
				}
			}
			catch (Exception exception)
			{
				Logger.TraceErr(exception);
				throw;
			}
			Utility.Logwatch(sw);
		}