Exemplo n.º 1
0
 private void AddImportSuffixToFavorite(FavoriteConfigurationElement favoriteToRename,
                                        FavoriteConfigurationElementCollection savedFavorites)
 {
     favoriteToRename.Name += importSuffix;
     if (savedFavorites[favoriteToRename.Name] != null)
         this.AddImportSuffixToFavorite(favoriteToRename, savedFavorites);
 }
Exemplo n.º 2
0
 private void CreateFavoriteButton(FavoriteConfigurationElementCollection favorites, string favoriteName)
 {
     FavoriteConfigurationElement favorite = favorites[favoriteName];
     if (favorite != null)
     {
         ToolStripButton favoriteBtn = this.CreateFavoriteButton(favorite);
         this.favoriteToolBar.Items.Add(favoriteBtn);
     }
 }
Exemplo n.º 3
0
        public static FavoriteConfigurationElementCollection GetFavorites(bool isDatabaseFavorite)
        {
            if (!isDatabaseFavorite)
            {
                TerminalsConfigurationSection section = GetSection();
                if (section != null)
                    return section.Favorites;
            }
            else
            {
                FavoriteConfigurationElementCollection collection = new FavoriteConfigurationElementCollection();

                using (TerminalsObjectContext dc = TerminalsObjectContext.Create())
                {
                	if (dc == null)
                		return null;
                	
                    foreach (var connection in dc.Connections)
                    {
                        FavoriteConfigurationElement favorite = connection.ToFavorite();
                        collection.Add(favorite);
                    }
                }

                return collection;
            }

            return null;
        }