示例#1
0
 private void OnAlphabeticalMenuDropDownOpening(object sender, EventArgs e)
 {
     if (!this.alphabeticalMenu.HasDropDownItems)
     {
         List <IFavorite> favorites = new SortableList <IFavorite>(PersistedFavorites)
                                      .SortByProperty("Name", SortOrder.Ascending);
         CreateAlphabeticalFavoriteMenuItems(favorites);
         var alphaMenuVisible = this.alphabeticalMenu.DropDownItems.Count > 0;
         this.alphabeticalMenu.Visible = alphaMenuVisible;
     }
 }
        internal SortableList <FavoriteConfigurationElement> ToList()
        {
            var favorites = new SortableList <FavoriteConfigurationElement>();

            foreach (FavoriteConfigurationElement favorite in this)
            {
                favorites.Add(favorite);
            }

            return(favorites);
        }
示例#3
0
        /// <summary>
        /// Replace the favorites in binding source doesnt affect performance
        /// </summary>
        private void UpdateFavoritesBindingSource(SortableList <IFavorite> newData)
        {
            var data = ConvertFavoritesToViewModel(newData);

            var lastSortedColumn = this.dataGridFavorites.FindLastSortedColumn();

            if (lastSortedColumn != null) // keep last ordered column
            {
                var backupGliph = lastSortedColumn.HeaderCell.SortGlyphDirection;
                this.bsFavorites.DataSource = data.SortByProperty(lastSortedColumn.DataPropertyName, backupGliph);
                lastSortedColumn.HeaderCell.SortGlyphDirection = backupGliph;
            }
            else
            {
                this.bsFavorites.DataSource = data;
            }

            UpdateCountLabels();
        }
示例#4
0
        private SortableList <FavoriteViewModel> ConvertFavoritesToViewModel(SortableList <IFavorite> source)
        {
            var sortedFavorites = source.Select(favorite => new FavoriteViewModel(favorite, this.persistence));

            return(new SortableList <FavoriteViewModel>(sortedFavorites));
        }
示例#5
0
 private void FavoritesSearchBox_Canceled(object sender, EventArgs e)
 {
     this.foundFavorites = new SortableList <IFavorite>();
     this.UpdateFavoritesBindingSource();
 }
示例#6
0
 private void FavoritesSearchBoxFound(object sender, FavoritesFoundEventArgs e)
 {
     this.foundFavorites = new SortableList <IFavorite>(e.Favorites);
     this.UpdateFavoritesBindingSource();
 }