Esempio n. 1
0
        public EditTags(AppIconSetting chosenApp, HashSet <FilterTag> allTags)
        {
            this.AllTags     = new HashSet <EditTagItem>(allTags.Count);
            this.Available   = new HashSet <EditTagItem>(this.AllTags.Count);
            this.Applied     = new HashSet <EditTagItem>(this.AllTags.Count);
            this.AppliedView = CollectionViewSource.GetDefaultView(this.AllTags);
            this.AppliedView.SortDescriptions.Add <EditTagItem, string>(ListSortDirection.Ascending, x => x.Title);
            this.AppliedView.Filter = x => x is EditTagItem eti && eti.Status == EditingStatus.Applied;

            this.AvailableView = CollectionViewSource.GetDefaultView(this.AllTags);
            this.AvailableView.SortDescriptions.Add <EditTagItem, string>(ListSortDirection.Ascending, x => x.Title);
            this.AvailableView.Filter = x => x is EditTagItem eti && eti.Status == EditingStatus.Available;

            foreach (EditTagItem ft in allTags)
            {
                this.AllTags.Add(ft);
            }

            for (int i = 0; i < this.AllTags.Count; i++)
            {
                EditTagItem eti = this.AllTags.ElementAt(i);
                if (chosenApp.Tags.Any(x => x.Tag.Equals(eti.Title)))
                {
                    eti.Status = EditingStatus.Applied;
                }
            }
        }
Esempio n. 2
0
        private void CreateBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(this.displayNameBox.Text) && !string.IsNullOrEmpty((string)this.findExeLbl.Content))
            {
                _answer    = true;
                CreatedApp = new AppIconSetting
                {
                    ExePath = this.findExeLbl.Content as string,
                    Name    = this.displayNameBox.Text,
                };
                if (!string.IsNullOrEmpty(this.argumentsBox.Text))
                {
                    CreatedApp.Arguments = this.argumentsBox.Text;
                }

                if (!string.IsNullOrEmpty((string)this.findIconLbl.Content))
                {
                    CreatedApp.IconPath = this.findIconLbl.Content as string;
                }

                CreatedApp.Index = !string.IsNullOrEmpty(this.iconIndexBox.Text)
                    ? Convert.ToInt32(this.iconIndexBox.Text)
                    : 0;

                this.Close();
            }
        }
Esempio n. 3
0
        public EditTags(AppIconSetting chosenApp, IEnumerable <FilterTag> allTags)
        {
            this.AllFilterTags = new HashSet <FilterTag>(allTags);
            this.Application   = chosenApp;
            this.AllTags       = new EditTagList(allTags, chosenApp);
            this.InitializeComponent();

            this.AppliedTagsList.ItemsSource   = this.AllTags.Applied;
            this.AvailableTagsList.ItemsSource = this.AllTags.Available;
        }
Esempio n. 4
0
        // Handle Edit OK
        private async Task HandleOkEdit(bool result, AppIconSetting modifiedApp)
        {
            if (result)
            {
                if (!modifiedApp.Tags.IsSubsetOf(this.AppList.Tags.GetTagsAsStrings()))
                {
                    await this.AddTagsToTagList(modifiedApp.Tags, this.AppList.Tags);
                }
                await this.RemoveAnyTagsFromTagList(this.AppList);

                await this.ApplyCheckBoxFilter();

                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.AppList.View.Refresh();
                });
            }
        }