Пример #1
0
 private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     var f = e.AddedItems;
     if (f.Count > 0)
     {
         SendTo = (Devices)f[0];
     }
 }
Пример #2
0
        private async Task LoadDevice()
        {
            var items = await App.MobileService.GetTable<Devices>().Where(todoItem => todoItem.UniqueId == GetHardwareId() && todoItem.User == Settings.User.UserId).ToCollectionAsync();

            foreach (var item in items)
            {
                Settings.Device = item.UniqueId;
            }
            if (String.IsNullOrEmpty(Settings.Device)) 
            {
                Devices d = new Devices();
                d.User = Settings.User.UserId;
                d.UniqueId = GetHardwareId();
                var k = Windows.Networking.Connectivity.NetworkInformation.GetHostNames();
                if (k != null)
                {
                    d.Name = k[0].DisplayName;
                }
                await App.MobileService.GetTable<Devices>().InsertAsync(d);
                Settings.Device = d.UniqueId;
            }
            
        }