Esempio n. 1
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lbConnections.SelectedItem != null)
            {
                var frm = new ManageConnectionForm
                {
                    txtName             = { Text = lbConnections.SelectedItem.ToString() },
                    txtConnectionString = { Text = _mConnectionString }
                };

                switch (frm.ShowDialog())
                {
                case DialogResult.OK:     // update
                    _dbUtil = new MyDatabaseUtil(frm.txtConnectionString.Text);
                    RefreshConnectionDropDown();
                    RefreshList();
                    break;

                case DialogResult.Abort:     // delete
                    _mConnectionString = string.Empty;
                    RefreshConnectionDropDown();
                    RefreshList();
                    break;
                }
            }
        }
Esempio n. 2
0
        private void lbConnections_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbConnections.SelectedItem != null)
            {
                var currentCursor = Cursor.Current;

                Cursor.Current     = Cursors.WaitCursor;
                _mConnectionString = XmlConfig.Instance.GetValue("//MyConnectionStrings//add[@key='" + lbConnections.SelectedItem + "']");
                _dbUtil            = new MyDatabaseUtil(_mConnectionString);
                RefreshList();
                Cursor.Current       = currentCursor;
                chkSelectAll.Checked = false;
            }
        }