Exemple #1
0
 public ObservableCollection <ItemViewModel> GetDevices()
 {
     return(new ObservableCollection <ItemViewModel>
     {
         ItemViewModelFactory.FromDevice(new PushbulletDevice
         {
             Nickname = "Device 1",
             Type = PushbulletDeviceType.Windows,
             Model = "Windows device"
         }),
         ItemViewModelFactory.FromDevice(new PushbulletDevice
         {
             Nickname = "Device 2",
             Type = PushbulletDeviceType.Android,
             Model = "Android device"
         }),
         ItemViewModelFactory.FromDevice(new PushbulletDevice
         {
             Nickname = "Device 3",
             Type = PushbulletDeviceType.Chrome,
             Model = "Chrome device"
         }),
         ItemViewModelFactory.FromDevice(new PushbulletDevice
         {
             Nickname = "Device 4",
             Type = PushbulletDeviceType.Firefox,
             Model = "Firefox device"
         }),
     });
 }
        public ObservableCollection <ItemViewModel> GetDevices()
        {
            EnsureClient();
            var devicesModel = new ObservableCollection <ItemViewModel>();

            Devices = _client.GetDevices().Devices.ToDictionary(device => device.Id, device => device);
            foreach (PushbulletDevice device in Devices.Values)
            {
                devicesModel.Add(ItemViewModelFactory.FromDevice(device));
            }
            return(devicesModel);
        }