private void MoveFavoriteAliasesGroup(GroupConfigurationElement configGroup)
 {
     IGroup group = FavoritesFactory.GetOrAddNewGroup(this.persistence, configGroup.Name);
     List<string> favoriteNames = configGroup.FavoriteAliases.GetFavoriteNames();
     List<IFavorite> groupFavorites = favoriteNames.Select(favoriteName => persistence.Favorites[favoriteName])
         .Where(favorite => favorite != null).ToList();
     group.AddFavorites(groupFavorites);
 }
Beispiel #2
0
        private void MoveFavoriteAliasesGroup(GroupConfigurationElement configGroup)
        {
            IGroup           group          = FavoritesFactory.GetOrAddNewGroup(this.persistence, configGroup.Name);
            List <string>    favoriteNames  = configGroup.FavoriteAliases.GetFavoriteNames();
            List <IFavorite> groupFavorites = favoriteNames.Select(favoriteName => persistence.Favorites[favoriteName])
                                              .Where(favorite => favorite != null).ToList();

            group.AddFavorites(groupFavorites);
        }
Beispiel #3
0
        private void lvGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            GroupConfigurationElement group = this.GetSelectedGroup();

            if (group != null)
            {
                this.LoadConnections(group);
            }
        }
Beispiel #4
0
        private void tsbDeleteGroup_Click(object sender, EventArgs e)
        {
            GroupConfigurationElement group = this.GetSelectedGroup();

            if (group != null)
            {
                Settings.DeleteGroup(group.Name);
                this.LoadGroups();
            }
        }
Beispiel #5
0
 private void tsbAddGroup_Click(object sender, EventArgs e)
 {
     using (NewGroupForm frmNewGroup = new NewGroupForm())
     {
         if (frmNewGroup.ShowDialog() == DialogResult.OK)
         {
             GroupConfigurationElement serversGroup = new GroupConfigurationElement
             {
                 Name            = frmNewGroup.txtGroupName.Text,
                 FavoriteAliases = new FavoriteAliasConfigurationElementCollection()
             };
             Settings.AddGroup(serversGroup);
             this.LoadGroups();
         }
     }
 }
Beispiel #6
0
        private void tsbDeleteConnection_Click(object sender, EventArgs e)
        {
            GroupConfigurationElement group = this.GetSelectedGroup();

            if (group != null)
            {
                if (this.lvConnections.SelectedItems.Count > 0)
                {
                    foreach (ListViewItem item in this.lvConnections.SelectedItems)
                    {
                        group.FavoriteAliases.Remove(item.Text);
                        Settings.DeleteGroup(group.Name);
                        Settings.AddGroup(group);
                        item.Remove();
                    }
                }
            }
        }
Beispiel #7
0
        private void tsbAddConnection_Click(object sender, EventArgs e)
        {
            GroupConfigurationElement group = this.GetSelectedGroup();

            if (group != null)
            {
                AddConnectionForm frmAddConnection = new AddConnectionForm(SaveInDB);
                if (frmAddConnection.ShowDialog() == DialogResult.OK)
                {
                    foreach (string connection in frmAddConnection.Connections)
                    {
                        group.FavoriteAliases.Add(new FavoriteAliasConfigurationElement(connection));
                        this.lvConnections.Items.Add(connection);
                    }
                    Settings.DeleteGroup(group.Name);
                    Settings.AddGroup(group);
                }
            }
        }
Beispiel #8
0
 private void LoadConnections(GroupConfigurationElement group)
 {
     this.lvConnections.BeginUpdate();
     try
     {
         this.lvConnections.Items.Clear();
         foreach (FavoriteAliasConfigurationElement favorite in group.FavoriteAliases)
         {
             ListViewItem item = this.lvConnections.Items.Add(favorite.Name);
             item.Name = favorite.Name;
         }
         if (this.lvConnections.Items.Count > 0)
         {
             this.lvConnections.Items[0].Focused  = true;
             this.lvConnections.Items[0].Selected = true;
         }
     }
     finally
     {
         this.lvConnections.EndUpdate();
     }
 }
Beispiel #9
0
 public static void AddGroup(GroupConfigurationElement group)
 {
     GetSection().Groups.Add(group);
     SaveImmediatelyIfRequested();
 }