示例#1
0
        internal void ReportFavoriteAdded(IFavorite addedFavorite)
        {
            var args = new FavoritesChangedEventArgs();

            args.Added.Add(addedFavorite);
            this.FireFavoriteChanges(args);
        }
示例#2
0
 internal void EndDelayedUpdate()
 {
     this.FireGroupsChangedEvent(this.groups);
     this.groups = null;
     this.FireFavoritesChangedEvent(this.favorites);
     this.favorites = null;
 }
示例#3
0
        internal void ReportFavoritesDeleted(List <IFavorite> deletedFavorites)
        {
            var args = new FavoritesChangedEventArgs();

            args.Removed.AddRange(deletedFavorites);
            this.FireFavoriteChanges(args);
        }
示例#4
0
        internal void ReportFavoriteUpdated(IFavorite changedFavorite)
        {
            var args = new FavoritesChangedEventArgs();

            args.Updated.Add(changedFavorite);
            this.FireFavoriteChanges(args);
        }
示例#5
0
        internal void ReportFavoritesAdded(List <IFavorite> addedFavorites)
        {
            var args = new FavoritesChangedEventArgs();

            args.Added.AddRange(addedFavorites);
            FireFavoriteChanges(args);
        }
示例#6
0
        internal void ReportFavoritesUpdated(List <IFavorite> changedFavorites)
        {
            var args = new FavoritesChangedEventArgs();

            args.Updated.AddRange(changedFavorites);
            this.FireFavoriteChanges(args);
        }
示例#7
0
        internal void ReportFavoriteDeleted(IFavorite deletedFavorite)
        {
            var args = new FavoritesChangedEventArgs();

            args.Removed.Add(deletedFavorite);
            this.FireFavoriteChanges(args);
        }
示例#8
0
        private void FireFavoriteChanges(FavoritesChangedEventArgs args)
        {
            if (args.IsEmpty)
            {
                return;
            }

            this.DeliverFavoriteChanges(args);
        }
 internal void AddFrom(FavoritesChangedEventArgs source)
 {
     var toAdd = ListsHelper.GetMissingSourcesInTarget(source.Added, this.Added);
     this.Added.AddRange(toAdd);
     var toUpdate = ListsHelper.GetMissingSourcesInTarget(source.Updated, this.Updated);
     this.Updated.AddRange(toUpdate);
     var toRemove = ListsHelper.GetMissingSourcesInTarget(source.Removed, this.Removed);
     this.Removed.AddRange(toRemove);
 }
示例#10
0
 internal void StartDelayedUpdate()
 {
     if (this.DelayedUpdate)
     {
         return;
     }
     this.groups    = new GroupsChangedArgs();
     this.favorites = new FavoritesChangedEventArgs();
 }
示例#11
0
 private void DeliverFavoriteChanges(FavoritesChangedEventArgs args)
 {
     if (this.DelayedUpdate)
     {
         this.favorites.AddFrom(args);
     }
     else
     {
         this.FireFavoritesChangedEvent(args);
     }
 }
        internal void AddFrom(FavoritesChangedEventArgs source)
        {
            var toAdd = ListsHelper.GetMissingSourcesInTarget(source.Added, this.Added);

            this.Added.AddRange(toAdd);
            var toUpdate = ListsHelper.GetMissingSourcesInTarget(source.Updated, this.Updated);

            this.Updated.AddRange(toUpdate);
            var toRemove = ListsHelper.GetMissingSourcesInTarget(source.Removed, this.Removed);

            this.Removed.AddRange(toRemove);
        }
示例#13
0
        private void FireFavoritesChangedEvent(FavoritesChangedEventArgs args)
        {
            // prevent persistence dummy call without start update
            if (args == null)
            {
                return;
            }

            Debug.WriteLine(args.ToString());

            this.FavoritesChanged?.Invoke(args);
        }
 private void DispatcherFavoritesChanged(FavoritesChangedEventArgs args)
 {
     this.addedCount += args.Added.Count;
     this.deletedCount += args.Removed.Count;
     this.updatedCount += args.Updated.Count;
 }
 private void OnFavoritesCollectionChanged(FavoritesChangedEventArgs args)
 {
     if (IsOrphan)
         this.UnregisterEvents();
     else
         this.PerformFavoritesUpdate(args);
 }
 private void PerformFavoritesUpdate(FavoritesChangedEventArgs args)
 {
     GroupTreeNode selectedGroup = this.treeList.FindSelectedGroupNode();
     IFavorite selectedFavorite = this.treeList.SelectedFavorite;
     var updater = new FavoritesLevelUpdate(this.RootNodes, args);
     updater.Run();
     this.treeList.RestoreSelectedFavorite(selectedGroup, selectedFavorite);
 }
 private void OnFavoritesChanged(FavoritesChangedEventArgs args)
 {
     foreach (IFavorite updated in args.Updated)
     {
         // dont update the rest of properties, because it doesnt reflect opened session
         UpdateDetachedWindowTitle(updated);
         UpdateAttachedTabTitle(updated);
     }
 }
        private void OnPrimaryStoreFavoritesChanged(FavoritesChangedEventArgs args)
        {
            var updated = args.Updated.FirstOrDefault();
            if (updated != null)
                this.updatedFavorite = updated;

            this.addEventCatched |= args.Added.Count > 0;
            this.updateEventCatched |= args.Updated.Count > 0;
            this.removedEventCatched |= args.Removed.Count > 0;
        }
 private void DispatcherOnFavoritesChanged(FavoritesChangedEventArgs args)
 {
     if (args.Added.Count == 1)
         this.addedFavoriteId = args.Added[0].Id;
     if (args.Removed.Count == 1)
         this.deletedFavoriteId = args.Removed[0].Id;
     if (args.Updated.Count == 1)
         this.updatedFavoriteId = args.Updated[0].Id;
 }
 private void OnUpdateAlreadyUpdatedFavoritesChanged(FavoritesChangedEventArgs args)
 {
     if (args.Removed.Count > 0)
         this.removedEventCatched = true;
 }
 /// <summary>
 /// we dont want to change the search user control state,
 /// we only want to kick off new search of favorites.
 /// Using this as an persistence event handler allowes to keep the results list up to date with the cache
 /// </summary>
 private void PersistenceFavoritesChanged(FavoritesChangedEventArgs args)
 {
     if (this.alreadySearched)
         this.RefreshSearch();
     else
         this.FireCanceled();
 }