private async void OnConnectToBaseStationButtonClick(object sender, RoutedEventArgs e) { if (SerialConnection == null) { BaseStationConnectionDialog Dialog = new BaseStationConnectionDialog(); if (await Dialog.ShowAsync() == ContentDialogResult.Primary) { await Dialog.Connection.Initialize(); SerialConnection = Dialog.Connection; } } else { SerialConnection.Dispose(); SerialConnection = null; LastUserData = null; UpdateText(); } ConnectToBaseStationButton.Content = SerialConnection == null ? "Connect to Base Station" : "Disconnect from Base Station"; }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Connection = new BaseStationConnection(Devices[DevicesListView.SelectedIndex].Id); }