Пример #1
0
        private async Task RemoveAnyTagsFromTagList(AppListViewCollection appList)
        {
            HashSet <FilterTag> allTags = appList.GetAllTagsAsSet(_ftEquality);

            if (allTags.IsProperSubsetOf(appList.Tags))
            {
                await this.Dispatcher.InvokeAsync(() =>
                {
                    appList.Tags.Reset(allTags);
                });

                string[] tagsAsStrings = appList.Tags.GetTagsAsStrings();
                if (!Checked.IsSubsetOf(tagsAsStrings))
                {
                    Checked.IntersectWith(tagsAsStrings);
                }

                await this.Dispatcher.InvokeAsync(() =>
                {
                    appList.Tags.View.Refresh();
                    foreach (FilterTag ft in appList.Tags.Where(x => Checked.Contains(x.Tag)))
                    {
                        ft.IsChecked = true;
                    }
                });
            }
        }
Пример #2
0
        internal AppListViewCollection Clone()
        {
            var col = new AppListViewCollection(this);

            foreach (SortDescription sd in this.View.SortDescriptions)
            {
                col.View.SortDescriptions.Add(sd);
            }
            return(col);
        }
Пример #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.IdentityBlock.Text = WindowsIdentity.GetCurrent().Name;
            App.MyHandle            = new WindowInteropHelper(this).Handle;

            this.AppList = App.JsonSettings.Settings.Apps;
            Checked      = new HashSet <string>(this.AppList.Tags.Count);

            this.AppListView.ItemsSource = this.AppList.View;
            this.FilterTags.ItemsSource  = this.AppList.Tags.View;

            this.AppList.CollectionChanged += this.AppList_Changed;
        }