コード例 #1
0
        private SavedConnection GetSelectedItem()
        {
            if (lstConnections.SelectedIndices.Count < 1)
            {
                return(SavedConnection.Empty);
            }

            SavedConnection conn = lstConnections.SelectedItems[0].Tag as SavedConnection;

            return(conn);
        }
コード例 #2
0
        public void SaveNewConnection(ConnectionStringEntry entry)
        {
            string connKey = string.Format("{0}_{1}", entry.ProjectName, entry.ConnectionName);

            SavedConnection newConn = new SavedConnection()
            {
                ConnectionString = entry.ConnectionString,
                Name = connKey
            };

            SaveNewConnection(newConn);
        }
コード例 #3
0
        public void SaveNewConnection(ConnectionStringEntry entry)
        {
            string connKey = string.Format("{0}_{1}", entry.ProjectName, entry.ConnectionName);

            SavedConnection newConn = new SavedConnection()
            {
                ConnectionString = entry.ConnectionString,
                Name             = connKey
            };

            SaveNewConnection(newConn);
        }
コード例 #4
0
        private void tsAddNewConnection_Click(object sender, EventArgs e)
        {
            SavedConnection newConn = new SavedConnection()
            {
                Name = "New Connection", ConnectionString = "DataSource=.;Initial Catalog=;Trusted Connection=true;"
            };
            ListViewItem itm = new ListViewItem();

            itm.Text = newConn.Name;
            itm.SubItems.Add(newConn.ConnectionString);
            itm.Tag = newConn;
            lstConnections.Items.Add(itm);

            SavedConnections.Add(newConn);
        }
コード例 #5
0
        private void tsAddConnection_Click(object sender, EventArgs e)
        {
            foreach (var itm in chkLstConfigs.CheckedItems)
            {
                ConnectionStringEntry conn = itm as ConnectionStringEntry;

                if (!string.IsNullOrEmpty(txtConnectionName.Text) && !string.IsNullOrEmpty(txtConnStr.Text))
                {
                    NewConnections.Add(new ConnectionStringEntry()
                    {
                        ConnectionName   = txtConnectionName.Text,
                        ConnectionString = txtConnStr.Text,
                        ConfigPath       = conn.ConfigPath,
                        ConfigFile       = conn.ConfigFile,
                        ProjectName      = conn.ProjectName,
                        ProjectItem      = conn.ProjectItem
                    });
                }

                foreach (var savedIitm in chkLstSavedConnections.CheckedItems)
                {
                    SavedConnection savedConn = savedIitm as SavedConnection;

                    NewConnections.Add(new ConnectionStringEntry()
                    {
                        ConnectionName   = savedConn.Name,
                        ConnectionString = savedConn.ConnectionString,
                        ConfigPath       = conn.ConfigPath,
                        ConfigFile       = conn.ConfigFile,
                        ProjectName      = conn.ProjectName,
                        ProjectItem      = conn.ProjectItem
                    });
                }
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
コード例 #6
0
        private void tsAddNewConnection_Click(object sender, EventArgs e)
        {
            SavedConnection newConn = new SavedConnection() { Name = "New Connection", ConnectionString = "DataSource=.;Initial Catalog=;Trusted Connection=true;" };
            ListViewItem itm = new ListViewItem();
            itm.Text = newConn.Name;
            itm.SubItems.Add(newConn.ConnectionString);
            itm.Tag = newConn;
            lstConnections.Items.Add(itm);

            SavedConnections.Add(newConn);
        }
コード例 #7
0
 public void RemoveConnection(SavedConnection connection)
 {
     _connections.Remove(connection);
     Save();
 }
コード例 #8
0
 public void SaveNewConnection(SavedConnection newConn)
 {
     _connections.Add(newConn);
     Save();
 }
コード例 #9
0
 void _view_ChangeConnection(ConnectionStringEntry entry, SavedConnection savedConn, bool silent)
 {
     entry.ConnectionString = savedConn.ConnectionString;
     WriteConfigChanges(entry.ConnectionName, entry);
     _view.RefreshView();
 }
コード例 #10
0
 void _view_ChangeConnection(ConnectionStringEntry entry, SavedConnection savedConn, bool silent)
 {
     entry.ConnectionString = savedConn.ConnectionString;
     WriteConfigChanges(entry.ConnectionName, entry);
     _view.RefreshView();
 }
コード例 #11
0
 public void SaveNewConnection(SavedConnection newConn)
 {
     _connections.Add(newConn);
     Save();
 }
コード例 #12
0
 public void RemoveConnection(SavedConnection connection)
 {
     _connections.Remove(connection);
     Save();
 }