private void ButtonAddConnection_OnClick(object sender, RoutedEventArgs e) { var ci = new ConnectionInfo(new MSSQLConnectionDescriptor(), GetNewConnectionEntryName(), ConnectionTypes.MSSQL, ""); var cef = new ConnectionEditWindow(ci) { Owner = this }; if (cef.ShowDialog() == true) { var item = new ConnectionListItem() { Name = ci.Name, Type = ci.Type.ToString(), Tag = ci }; var source = LvConnections.ItemsSource as ObservableCollection <ConnectionListItem>; if (source != null) { source.Add(item); } App.Connections.Add(ci); LvConnections.SelectedItem = item; } LvConnections.Focus(); Properties.Settings.Default.XmlFiles = App.XmlFiles; Properties.Settings.Default.Connections = App.Connections; Properties.Settings.Default.Save(); }
private void ButtonAddXml_OnClick(object sender, RoutedEventArgs e) { ConnectionInfo ci = new ConnectionInfo(string.Empty, GetNewXmlFileEntryName(), ConnectionTypes.ODBC) { IsXmlFile = true }; var cef = new XmlConnectionEditWindow(ci) { Owner = this }; if (cef.ShowDialog() == true) { var item = new ConnectionListItem() { Name = ci.Type.ToString(), Type = ci.ConnectionDescriptor.SyntaxProvider.Description, Tag = ci }; var source = LvXmlFiles.ItemsSource as ObservableCollection <ConnectionListItem>; if (source != null) { source.Add(item); } App.XmlFiles.Add(ci); LvXmlFiles.SelectedItem = item; } LvXmlFiles.Focus(); Properties.Settings.Default.XmlFiles = App.XmlFiles; Properties.Settings.Default.Connections = App.Connections; Properties.Settings.Default.Save(); }