private void ButPair_Click(object sender, RoutedEventArgs e) { StringDialog wndPair = new StringDialog("Pairing", "Enter the code you can see on the device and click ok."); if (wndPair.ShowDialog().GetValueOrDefault(false)) { _viewModel.Pair(wndPair.Result); } }