Пример #1
0
        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";
        }
Пример #2
0
 private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     Connection = new BaseStationConnection(Devices[DevicesListView.SelectedIndex].Id);
 }