private void SelectSource_SelectionChanged(object sender, SelectionChangedEventArgs e) { var tag = ((ComboBoxItem)SelectSource.SelectedItem)?.Tag; if (tag?.ToString() == "1") { var connect = new ConnectWindow("SelectSource"); var result = connect.ShowDialog(); if (result == true) { if (SelectSource.Items.Count > 1) { SelectSource.Items.RemoveAt(1); } SourceConnection = connect.ConnectionString; SourceName = connect.ConnectionName; SelectSource.Items.Add(new ComboBoxItem { Content = connect.ConnectionName, DataContext = connect.ConnectionString, IsSelected = true, }); } else { SelectSource.SelectedIndex = -1; } } EnableCompare(); }
private void SelectTarget_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { var tag = ((ComboBoxItem)SelectTarget.SelectedItem)?.Tag; if (tag?.ToString() == "1") { var connect = new ConnectWindow("SelectTarget"); var result = connect.ShowDialog(); if (result == true) { if (SelectTarget.Items.Count > 1) { SelectTarget.Items.RemoveAt(1); } TargetConnection = connect.ConnectionString; TargetName = connect.ConnectionName; SelectTarget.Items.Add(new ComboBoxItem { Content = connect.ConnectionName, DataContext = connect.ConnectionString, IsSelected = true, }); } else { SelectTarget.SelectedIndex = -1; } } EnableCompare(); } catch (Exception ex) { App.ShowAndLogError(ex); } }