// Initialize Stuff public async void Initialize() { CellularLines = await GetSmsDevices(); if (CellularLines.Count != 0) { SelectedLine = CellularLines[0]; } }
// Methods private static async Task <ObservableCollection <CellularLineControl> > GetSmsDevices() { ObservableCollection <CellularLineControl> collection = new ObservableCollection <CellularLineControl>(); var smsDevices = await DeviceInformation.FindAllAsync(SmsDevice2.GetDeviceSelector(), null); foreach (var smsDevice in smsDevices) { try { SmsDevice2 dev = SmsDevice2.FromId(smsDevice.Id); CellularLineControl control = new CellularLineControl(dev); collection.Add(control); } catch { } } return(collection); }
private async void Load() { var smsDevices = await DeviceInformation.FindAllAsync(SmsDevice2.GetDeviceSelector(), null); foreach (var smsDevice in smsDevices) { try { SmsDevice2 dev = SmsDevice2.FromId(smsDevice.Id); CellularLineControl control = new CellularLineControl(dev); cellularlineControls.Add(control); CellularLineComboBox.Items.Add(new ComboBoxItem() { Content = control }); } catch { } } }