private async void newButton_Click(object sender, RoutedEventArgs e)
{
var newDeviceDlg = new NewDevice();
var action = newDeviceDlg.ShowModal();
if (action.HasValue && action.Value)
{
// Create a new device and add it to the list
var deviceId = newDeviceDlg.textBox.Text;
var newDevice = await this.createNewDevice(deviceId);
if (newDevice != null)
{
this.listBox.Items.Add(deviceId);
this.okButton.IsEnabled = true;
this.Devices.Add(newDevice);
}
}
}