/// <summary>
        /// Shows this dialog to the user asking for group name.
        /// If user confirms, the entered value is returned; otherwiser returns empty string.
        /// </summary>
        internal static string AskFroGroupName(IPersistence persistence)
        {
            using (var frmNewGroup = new NewGroupForm())
            {
                if (frmNewGroup.ShowDialog() == DialogResult.OK)
                    return ValidateNewGroupName(persistence, frmNewGroup.txtGroupName.Text);

                return string.Empty;
            }
        }
 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();
         }
     }
 }
Beispiel #3
0
        private void NewGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // backup the selected tree node, because it will be replaced later by focus of NewGroupForm
            GroupTreeNode parentGroupNode = this.favsTree.SelectedGroupNode;
            string        newGroupName    = NewGroupForm.AskFroGroupName(this.persistence);

            if (string.IsNullOrEmpty(newGroupName))
            {
                return;
            }

            IGroup newGroup = this.persistence.Factory.CreateGroup(newGroupName);

            if (parentGroupNode != null)
            {
                newGroup.Parent = parentGroupNode.Group;
            }

            this.persistence.Groups.Add(newGroup);
        }
 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();
         }
     }
 }
 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();
         }
     }
 }