Beispiel #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);
            }
        }
        private void lstConnections_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var entry = GetSelectedItem();

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

            ConnectionStringEditor editor = new ConnectionStringEditor();

            var result = editor.ShowDialog(entry.Name, entry.ConnectionString);

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

            entry.Name             = editor.ConnectionName;
            entry.ConnectionString = editor.ConnectionString;
            lstConnections.SelectedItems[0].SubItems[0].Text = entry.Name;
            lstConnections.SelectedItems[0].SubItems[1].Text = entry.ConnectionString;
            BindToGrid();
        }
        private void lstConnections_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var entry = GetSelectedItem();
            if (entry == SavedConnection.Empty) { return; }

            ConnectionStringEditor editor = new ConnectionStringEditor();

            var result = editor.ShowDialog(entry.Name, entry.ConnectionString);

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

            entry.Name = editor.ConnectionName;
            entry.ConnectionString = editor.ConnectionString;
            lstConnections.SelectedItems[0].SubItems[0].Text = entry.Name;
            lstConnections.SelectedItems[0].SubItems[1].Text = entry.ConnectionString;
            BindToGrid();
        }
        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);
            }
        }