private void AddImportSuffixToFavorite(FavoriteConfigurationElement favoriteToRename, FavoriteConfigurationElementCollection savedFavorites) { favoriteToRename.Name += importSuffix; if (savedFavorites[favoriteToRename.Name] != null) this.AddImportSuffixToFavorite(favoriteToRename, savedFavorites); }
private void CreateFavoriteButton(FavoriteConfigurationElementCollection favorites, string favoriteName) { FavoriteConfigurationElement favorite = favorites[favoriteName]; if (favorite != null) { ToolStripButton favoriteBtn = this.CreateFavoriteButton(favorite); this.favoriteToolBar.Items.Add(favoriteBtn); } }
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; }