public void Remove(GroupConfigurationElement item) { if (BaseIndexOf(item) >= 0) { BaseRemove(item.Name); } }
public static void AddGroup(GroupConfigurationElement group) { Configuration configuration = GetConfiguration(); GetSection(configuration).Groups.Add(group); configuration.Save(); }
private void lvGroups_SelectedIndexChanged(object sender, EventArgs e) { GroupConfigurationElement group = GetSelectedGroup(); if (group != null) { LoadConnections(group); } }
private void tsbDeleteGroup_Click(object sender, EventArgs e) { GroupConfigurationElement group = GetSelectedGroup(); if (group != null) { Settings.DeleteGroup(group.Name); LoadGroups(); } }
private void tsbAddGroup_Click(object sender, EventArgs e) { using (NewGroupForm frmNewGroup = new NewGroupForm()) { if (frmNewGroup.ShowDialog() == DialogResult.OK) { GroupConfigurationElement serversGroup = new GroupConfigurationElement(); serversGroup.Name = frmNewGroup.txtGroupName.Text; serversGroup.FavoriteAliases = new FavoriteAliasConfigurationElementCollection(); Settings.AddGroup(serversGroup); LoadGroups(); } } }
private void tsbDeleteConnection_Click(object sender, EventArgs e) { GroupConfigurationElement group = GetSelectedGroup(); if (group != null) { if (lvConnections.SelectedItems.Count > 0) { foreach (ListViewItem item in lvConnections.SelectedItems) { group.FavoriteAliases.Remove(item.Text); Settings.DeleteGroup(group.Name); Settings.AddGroup(group); item.Remove(); } } } }
private void tsbAddConnection_Click(object sender, EventArgs e) { GroupConfigurationElement group = GetSelectedGroup(); if (group != null) { AddConnectionForm frmAddConnection = new AddConnectionForm(); if (frmAddConnection.ShowDialog() == DialogResult.OK) { foreach (string connection in frmAddConnection.Connections) { group.FavoriteAliases.Add(new FavoriteAliasConfigurationElement(connection)); lvConnections.Items.Add(connection); } Settings.DeleteGroup(group.Name); Settings.AddGroup(group); } } }
private void LoadConnections(GroupConfigurationElement group) { lvConnections.BeginUpdate(); try { lvConnections.Items.Clear(); foreach (FavoriteAliasConfigurationElement favorite in group.FavoriteAliases) { ListViewItem item = lvConnections.Items.Add(favorite.Name); item.Name = favorite.Name; } if (lvConnections.Items.Count > 0) { lvConnections.Items[0].Focused = true; lvConnections.Items[0].Selected = true; } } finally { lvConnections.EndUpdate(); } }
public int IndexOf(GroupConfigurationElement item) { return BaseIndexOf(item); }
public int IndexOf(GroupConfigurationElement item) { return(BaseIndexOf(item)); }
private void AddGroup(GroupConfigurationElement group) { Log.InsideMethod(); ToolStripMenuItem groupToolStripMenuItem = new ToolStripMenuItem(group.Name) {Name = @group.Name}; groupToolStripMenuItem.Click += this.groupToolStripMenuItem_Click; this.groupsToolStripMenuItem.DropDownItems.Add(groupToolStripMenuItem); ToolStripMenuItem groupAddToolStripMenuItem = new ToolStripMenuItem(group.Name) {Name = @group.Name}; groupAddToolStripMenuItem.Click += this.groupAddToolStripMenuItem_Click; this.addTerminalToGroupToolStripMenuItem.DropDownItems.Add(groupAddToolStripMenuItem); }
public void Add(GroupConfigurationElement item) { BaseAdd(item); }
public void Remove(GroupConfigurationElement item) { if (BaseIndexOf(item) >= 0) BaseRemove(item.Name); }
private void AddGroup(GroupConfigurationElement group) { ToolStripMenuItem groupToolStripMenuItem = new ToolStripMenuItem(group.Name); groupToolStripMenuItem.Name = group.Name; groupToolStripMenuItem.Click += new EventHandler(groupToolStripMenuItem_Click); groupsToolStripMenuItem.DropDownItems.Add(groupToolStripMenuItem); ToolStripMenuItem groupAddToolStripMenuItem = new ToolStripMenuItem(group.Name); groupAddToolStripMenuItem.Name = group.Name; groupAddToolStripMenuItem.Click += new EventHandler(groupAddToolStripMenuItem_Click); addTerminalToGroupToolStripMenuItem.DropDownItems.Add(groupAddToolStripMenuItem); }
private void saveTerminalsAsGroupToolStripMenuItem_Click(object sender, EventArgs e) { using(NewGroupForm frmNewGroup = new NewGroupForm()) { if(frmNewGroup.ShowDialog() == DialogResult.OK) { GroupConfigurationElement serversGroup = new GroupConfigurationElement(); serversGroup.Name = frmNewGroup.txtGroupName.Text; foreach(TabControlItem tabControlItem in tcTerminals.Items) { serversGroup.FavoriteAliases.Add(new FavoriteAliasConfigurationElement(tabControlItem.Title)); } Settings.AddGroup(serversGroup); LoadGroups(); } } }