UpdateConnectionsFrom() public method

public UpdateConnectionsFrom ( string configFilePath, Action added ) : void
configFilePath string
added Action
return void
Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            var loadProviderDLLs = (ConfigurationManager.AppSettings["LoadProviderDLLs"] ?? "")
                .Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var dll in loadProviderDLLs)
                try
                {
                    Assembly.LoadFrom(dll);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Can't load: " + dll + "\n" + ex.ToString());
                }

            _connections = new BindingList<GeneratorConfig.Connection>();
            _tables = new BindingList<string>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
                _connections.Add(connection);

            if (!config.WebProjectFile.IsEmptyOrNull())
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            _connections = new BindingList<GeneratorConfig.Connection>();
            _tables = new BindingList<string>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
                _connections.Add(connection);

            if (!config.WebProjectFile.IsEmptyOrNull())
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
        }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();

            _connections = new BindingList <GeneratorConfig.Connection>();
            _tables      = new BindingList <string>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
            {
                _connections.Add(connection);
            }

            if (!config.WebProjectFile.IsEmptyOrNull())
            {
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
            }
        }
Beispiel #4
0
        public MainWindow()
        {
            InitializeComponent();

            var loadProviderDLLs = (ConfigurationManager.AppSettings["LoadProviderDLLs"] ?? "")
                                   .Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var dll in loadProviderDLLs)
            {
                try
                {
                    Assembly.LoadFrom(dll);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Can't load: " + dll + "\n" + ex.ToString());
                }
            }

            _connections = new BindingList <GeneratorConfig.Connection>();
            _tables      = new BindingList <TableItem>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
            {
                _connections.Add(connection);
            }

            if (!config.WebProjectFile.IsEmptyOrNull())
            {
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
            }
        }
Beispiel #5
0
        public MainWindow()
        {
            InitializeComponent();

            var loadProviderDLLs = (ConfigurationManager.AppSettings["LoadProviderDLLs"] ?? "")
                                   .Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var dll in loadProviderDLLs)
            {
                try
                {
                    Assembly.LoadFrom(dll);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Can't load: " + dll + "\n" + ex.ToString());
                }
            }

            _connections = new BindingList <GeneratorConfig.Connection>();
            _tables      = new BindingList <TableItem>();

            this.ConnectionsCombo.DataContext = _connections;
            this.DataContext = this;

            this.config = GeneratorConfig.Load();

            foreach (var connection in config.Connections)
            {
                _connections.Add(connection);
            }

            if (!config.WebProjectFile.IsEmptyOrNull())
            {
                config.UpdateConnectionsFrom(GetWebConfigLocation(), x => _connections.Add(x));
            }

            if (!string.IsNullOrEmpty(config.CustomTemplates))
            {
                Templates.TemplatePath = config.CustomTemplates;
            }

            if (config.CustomSettings != null)
            {
                foreach (var pair in config.CustomSettings.OrderBy(x => x.Key))
                {
                    if (pair.Value is Boolean)
                    {
                        var binding = new Binding("CustomSettings[" + pair.Key + "]");
                        binding.Source = this;
                        var checkbox = new CheckBox();
                        checkbox.SetBinding(CheckBox.IsCheckedProperty, binding);
                        checkbox.Content             = Inflector.Inflector.Titleize(pair.Key);
                        checkbox.HorizontalAlignment = HorizontalAlignment.Left;
                        checkbox.Margin = new Thickness(10, 0, 10, 0);
                        checkbox.Click += (s, e) =>
                        {
                            CustomSettings[pair.Key] = checkbox.IsChecked;
                            config.Save();
                        };
                        GenerationOptions.Children.Add(checkbox);
                    }
                    else
                    {
                        var dockPanel = new DockPanel();
                        dockPanel.LastChildFill = true;
                        dockPanel.Margin        = new Thickness(5);
                        var textBlock = new TextBlock();
                        textBlock.Margin = new Thickness(0, 0, 4, 0);
                        textBlock.Width  = 200;
                        textBlock.Text   = Inflector.Inflector.Titleize(pair.Key);
                        dockPanel.Children.Add(textBlock);

                        var binding = new Binding("CustomSettings[" + pair.Key + "]");
                        binding.Source = this;
                        var textbox = new TextBox();
                        textbox.SetBinding(TextBox.TextProperty, binding);
                        textbox.TextChanged += (s, e) =>
                        {
                            CustomSettings[pair.Key] = textbox.Text;
                            config.Save();
                        };
                        dockPanel.Children.Add(textbox);
                        GenerationOptions.Children.Add(dockPanel);
                        DockPanel.SetDock(dockPanel, Dock.Top);
                        DockPanel.SetDock(textBlock, Dock.Left);
                        dockPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
                    }
                }
            }
        }