コード例 #1
0
        public NodeCategoryViewModel(string name, IEnumerable <NodeSearchElementViewModel> entries, IEnumerable <NodeCategoryViewModel> subs)
        {
            ClickedCommand = new DelegateCommand(Expand);

            Name          = name;
            this.entries  = new ObservableCollection <NodeSearchElementViewModel>(entries);
            subCategories = new ObservableCollection <NodeCategoryViewModel>(subs);

            foreach (var category in SubCategories)
            {
                category.PropertyChanged += CategoryOnPropertyChanged;
            }

            Entries.CollectionChanged       += OnCollectionChanged;
            SubCategories.CollectionChanged += OnCollectionChanged;
            SubCategories.CollectionChanged += SubCategoriesOnCollectionChanged;

            items = new ObservableCollection <ISearchEntryViewModel>(
                Entries.Cast <ISearchEntryViewModel>().Concat(SubCategories)
                .OrderBy(x => x.Name));

            Items.CollectionChanged += ItemsOnCollectionChanged;

            foreach (var item in Items)
            {
                item.PropertyChanged += ItemOnPropertyChanged;
            }

            Visibility = true;
            IsExpanded = false;
        }
コード例 #2
0
 private void StartDownload()
 {
     foreach (var downloadItems in Entries.Cast <DownloadList>().Where(downloadItems => downloadItems.Entries.Count > 0))
     {
         var items = downloadItems;
         Task.Factory.StartNew(items.Download);
     }
 }
コード例 #3
0
        private void SyncItems()
        {
            Items.CollectionChanged -= ItemsOnCollectionChanged;

            foreach (var item in items)
            {
                item.PropertyChanged -= ItemOnPropertyChanged;
            }

            items = new ObservableCollection <ISearchEntryViewModel>(
                Entries.Cast <ISearchEntryViewModel>().Concat(SubCategories)
                .OrderBy(x => x.Name));

            Items.CollectionChanged += ItemsOnCollectionChanged;

            foreach (var item in items)
            {
                item.PropertyChanged += ItemOnPropertyChanged;
            }
        }
コード例 #4
0
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
 /// </returns>
 /// <filterpriority>1</filterpriority>
 IEnumerator <IAction> IEnumerable <IAction> .GetEnumerator()
 {
     return(Entries.Cast <IAction>().GetEnumerator());
 }
コード例 #5
0
ファイル: Folder.cs プロジェクト: Myvar/Eclang
 public List <File> GetFiles()
 {
     return(Entries.Cast <File>().ToList());
 }