private void EditServer_Click(object sender, RoutedEventArgs e)
        {
            Debug.Assert(gridServers.SelectedItem != null);
            if (gridServers.SelectedItem == null)
            {
                return;
            }
            Debug.Assert(gridServers.SelectedItem is ConnectionProfile);
            if (!(gridServers.SelectedItem is ConnectionProfile))
            {
                return;
            }
            var connProfile = (ConnectionProfile)gridServers.SelectedItem;

            var dlg = new ServerDetailsWindow();

            dlg.DataContext = connProfile;
            var dlgResult = dlg.ShowDialog();

            dlg.Close();
            if (dlgResult.HasValue && dlgResult.Value == true && DataContext != null && DataContext is SettingsViewModel)
            {
                var viewModel = (SettingsViewModel)DataContext;
                if (viewModel.EditServerCommand.CanExecute(null))
                {
                    viewModel.EditServerCommand.Execute(connProfile);
                }
            }
        }
        private void AddServer_Click(object sender, RoutedEventArgs e)
        {
            var connProfile = new ConnectionProfile();
            var dlg         = new ServerDetailsWindow();

            dlg.DataContext = connProfile;
            var dlgResult = dlg.ShowDialog();

            dlg.Close();
            if (dlgResult.HasValue && dlgResult.Value == true && DataContext != null && DataContext is SettingsViewModel)
            {
                var viewModel = (SettingsViewModel)DataContext;
                if (viewModel.AddServerCommand.CanExecute(null))
                {
                    viewModel.AddServerCommand.Execute(connProfile);
                }
            }
        }