private void ButtonRemoveXml_OnClick(object sender, RoutedEventArgs e)
        {
            var item = (ConnectionListItem)LvXmlFiles.SelectedItem;

            if (item == null)
            {
                return;
            }

            var source = LvXmlFiles.ItemsSource as ObservableCollection <ConnectionListItem>;

            if (source == null)
            {
                return;
            }

            source.Remove(item);

            App.XmlFiles.Remove((ConnectionInfo)item.Tag);

            LvXmlFiles.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)
        {
            var ci = new ConnectionInfo(ConnectionTypes.MSSQL, GetNewXmlFileEntryName(), null, true, "");

            var cef = new AddConnectionWindow(ci)
            {
                Owner = this
            };

            if (cef.ShowDialog() == true)
            {
                var item = new ConnectionListItem()
                {
                    Name = ci.Type.ToString(),
                    Type = ci.Type.ToString(),
                    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();
        }
        private void ButtonConfigureXml_OnClick(object sender, RoutedEventArgs e)
        {
            var item = (ConnectionListItem)LvXmlFiles.SelectedItem;

            if (item == null)
            {
                return;
            }

            var ci = (ConnectionInfo)item.Tag;

            var cef = new AddConnectionWindow(ci);

            if (cef.ShowDialog() == true)
            {
                item.Name = ci.Name;
                item.Type = ci.Type.ToString();
            }

            LvXmlFiles.Focus();
        }
        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();
        }
        private void ButtonConfigureXml_OnClick(object sender, RoutedEventArgs e)
        {
            var item = (ConnectionListItem)LvXmlFiles.SelectedItem;

            if (item == null)
            {
                return;
            }

            var ci = (ConnectionInfo)item.Tag;

            var cef = new XmlConnectionEditWindow(ci)
            {
                Owner = this
            };

            if (cef.ShowDialog() == true)
            {
                item.Name = ci.Name;
                item.Type = ci.ConnectionDescriptor.SyntaxProvider.Description;
            }

            LvXmlFiles.Focus();
        }