Пример #1
0
        private void tsEdit_Click(object sender, EventArgs e)
        {
            ConnectionStringEntry entry = GetSelectedEntry();

            if (entry == ConnectionStringEntry.Empty)
            {
                return;
            }

            ConnectionStringEditor     editor    = new ConnectionStringEditor();
            GenericConnectionPresenter presenter = new GenericConnectionPresenter(editor);

            if (editor.ShowDialog(entry.ConnectionName, entry.ConnectionString) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            string connectionName = entry.ConnectionName;

            entry.ConnectionString = editor.ConnectionString;
            entry.ConnectionName   = editor.ConnectionName;
            lstConnectionStrings.SelectedItems[0].SubItems[2].Text = entry.ConnectionName;
            lstConnectionStrings.SelectedItems[0].SubItems[3].Text = entry.ConnectionString;

            if (this.UpdateConnection != null)
            {
                this.UpdateConnection.Invoke(connectionName, entry, false);
            }
        }
Пример #2
0
        private void tsAddNewConnection_Click(object sender, EventArgs e)
        {
            NewConnection view = new NewConnection();
            GenericConnectionPresenter presenter = new GenericConnectionPresenter(view);

            var result = view.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            if (this.AddConnection != null)
            {
                foreach (ConnectionStringEntry conn in view.NewConnections)
                {
                    this.AddConnection.Invoke(conn, false);
                }
            }
        }
        private void tsEdit_Click(object sender, EventArgs e)
        {
            ConnectionStringEntry entry = GetSelectedEntry();
            if (entry == ConnectionStringEntry.Empty) { return; }

            ConnectionStringEditor editor = new ConnectionStringEditor();
            GenericConnectionPresenter presenter = new GenericConnectionPresenter(editor);

            if (editor.ShowDialog(entry.ConnectionName, entry.ConnectionString) == System.Windows.Forms.DialogResult.Cancel) { return; }

            string connectionName = entry.ConnectionName;
            entry.ConnectionString = editor.ConnectionString;
            entry.ConnectionName = editor.ConnectionName;
            lstConnectionStrings.SelectedItems[0].SubItems[2].Text = entry.ConnectionName;
            lstConnectionStrings.SelectedItems[0].SubItems[3].Text = entry.ConnectionString;

            if (this.UpdateConnection != null)
            {
                this.UpdateConnection.Invoke(connectionName, entry, false);
            }
        }
        private void tsAddNewConnection_Click(object sender, EventArgs e)
        {
            NewConnection view = new NewConnection();
            GenericConnectionPresenter presenter = new GenericConnectionPresenter(view);

            var result = view.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK) { return; }

            if (this.AddConnection != null)
            {
                foreach (ConnectionStringEntry conn in view.NewConnections)
                {
                    this.AddConnection.Invoke(conn, false);
                }
            }
        }