Exemplo n.º 1
0
        public void OnDeviceChange(object newDevicesObject)
        {
            var newDevices     = JsonConvert.DeserializeObject <List <MediaDeviceInfo> >(newDevicesObject.ToString());
            var removedDevices = CurrentMediaDevices.Where(cmd => !newDevices.Any(nd => cmd.Name == nd.Name)).ToList();
            var addedDevices   = newDevices.Where(nd => !CurrentMediaDevices.Any(cmd => cmd.Name == nd.Name)).ToList();

            OnDeviceChanged?.Invoke(this, new DeviceChangeEventArgs()
            {
                Devices        = newDevices,
                RemovedDevices = removedDevices,
                AddedDevices   = addedDevices
            });
            CurrentMediaDevices = newDevices;
        }
 public void Select(int i)
 {
     if (i != selected)
     {
         if (names.Contains("Default"))
         {
             names.Remove("Default");
             i--;
             if (OnOptionsChanged != null)
             {
                 OnOptionsChanged.Invoke();
             }
         }
         selected = i;
         ChangeDevice((ushort)selected);
         if (OnDeviceChanged != null)
         {
             OnDeviceChanged.Invoke();
         }
     }
 }
Exemplo n.º 3
0
 public void OnDeviceChangedInvoke(IDevice device)
 {
     OnDeviceChanged.Invoke(Mapper.Map(device));
 }
Exemplo n.º 4
0
 public void DeviceChange(string deviceId)
 {
     OnDeviceChanged?.Invoke(this, deviceId);
 }