Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TagViewModel"/> class.
 /// </summary>
 /// <param name="tags">The tags view model that created this tag.</param>
 /// <param name="name">The name of this tag.</param>
 /// <param name="taggedAssets">The assets who have this flag.</param>
 /// <param name="selectedAssetsCount">The number of assets currently selected, whether or not they have this tag.</param>
 public TagViewModel(TagsViewModel tags, string name, IEnumerable <AssetViewModel> taggedAssets, int selectedAssetsCount)
     : base(tags.SafeArgument(nameof(tags)).ServiceProvider)
 {
     this.tags = tags;
     this.selectedAssetsCount = selectedAssetsCount;
     Name = name;
     // Add assets before monitoring the Assets collection
     Assets.AddRange(taggedAssets);
     Assets.CollectionChanged += CollectionChanged;
     RemoveTagCommand          = new AnonymousCommand(ServiceProvider, RemoveTag);
     AddTagToAllCommand        = new AnonymousCommand(ServiceProvider, () => tags.AddTagCommand.Execute(Name));
     UpdateCounter();
 }
Beispiel #2
0
        private void RefreshAssets()
        {
            if (IsBusy)
            {
                return;
            }

            Assets.Clear();
            IsBusy     = true;
            pageNumber = 1;

            Task.Run(async() =>
            {
                var result = await LoadAssetsAsync(pageNumber);
                Assets.AddRange(result);
            });
            IsBusy = false;
        }
Beispiel #3
0
        private void LoadMoreAssets()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            Task.Run(async() =>
            {
                var result = await LoadAssetsAsync(pageNumber + 1);
                if (result?.Any() == true)
                {
                    Assets.AddRange(result);
                    pageNumber += 1;
                }
            });
            IsBusy = false;
        }