private void ConnectButton_Click(object sender, RoutedEventArgs e) { var connectWindow = new ConnectWindow(); var result = connectWindow.ShowDialog().Value; if (result) { ConnectToApp(connectWindow.SelectedDeviceItem); } }