AzureIoTHubConnectedService.DeviceSelectionDialog.newButton_Click C# (CSharp) Method

newButton_Click() private method

private newButton_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        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);
                }
            }
        }