/// <summary>
        /// Updates the entries (via Remove and Add) in the ALL items collection
        /// with the entries in the <param name="viewModels"/> array parameter.
        /// </summary>
        /// <param name="viewModels"></param>
        private void UpdateAllEntries(params VM[] viewModels)
        {
            Logger.InfoFormat("_");

            _All.SuspendCollectionChangeNotification();
            try
            {
                var removeItems = _All.Where(vm => !viewModels.Contains(vm)).ToList();
                var addItems    = viewModels.Where(vm => !_All.Contains(vm)).ToList();

                foreach (var vm in removeItems)
                {
                    _All.Remove(vm);
                }

                foreach (var vm in addItems)
                {
                    _All.Add(vm);
                }
            }
            finally
            {
                _All.NotifyChanges();

                if (this.EntriesChanged != null)
                {
                    this.EntriesChanged(this, EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 2
0
        private void updateEntries(params VM[] viewModels)
        {
            FastObservableCollection <VM> all = All as FastObservableCollection <VM>;

            all.SuspendCollectionChangeNotification();

            var removeItems = all.Where(vm => !viewModels.Contains(vm)).ToList();
            var addItems    = viewModels.Where(vm => !all.Contains(vm)).ToList();

            if (addItems.Count == 0 && removeItems.Count == 0)
            {
                return; //nothing to do here
            }
            foreach (var vm in removeItems)
            {
                all.Remove(vm);
            }

            foreach (var vm in addItems)
            {
                all.Add(vm);
            }

            _subItemList = all.ToArray().ToList();
            all.NotifyChanges();

            EntriesChanged?.Invoke(this, EventArgs.Empty);
        }
Ejemplo n.º 3
0
        private void updateEntries(params VM[] viewModels)
        {
            FastObservableCollection <VM> all = All as FastObservableCollection <VM>;

            all.SuspendCollectionChangeNotification();

            var removeItems = all.Where(vm => !viewModels.Contains(vm)).ToList();
            var addItems    = viewModels.Where(vm => !all.Contains(vm)).ToList();

            foreach (var vm in removeItems)
            {
                all.Remove(vm);
            }

            foreach (var vm in addItems)
            {
                all.Add(vm);
            }

            _subItemList = all.ToArray().ToList();
            all.NotifyChanges();

            if (EntriesChanged != null)
            {
                EntriesChanged(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 4
0
 public static void Update <T>(this FastObservableCollection <T> source, IEnumerable <T> update)
 {
     source.SuspendCollectionChangeNotification();
     try
     {
         Update((ObservableCollection <T>)source, update);
     }
     finally
     {
         source.NotifyChanges();
     }
 }
Ejemplo n.º 5
0
        private void setEntries(params VM[] viewModels)
        {
            _subItemList = viewModels.ToList();
            FastObservableCollection <VM> all = All as FastObservableCollection <VM>;

            all.SuspendCollectionChangeNotification();
            all.Clear();
            all.NotifyChanges();
            all.AddItems(viewModels);
            all.NotifyChanges();

            if (EntriesChanged != null)
            {
                EntriesChanged(this, EventArgs.Empty);
            }
        }
        /// <summary>
        /// Resets the entries (via Clear and Add) in the ALL items collection
        /// with the entries in the <param name="viewModels"/> parameter.
        /// </summary>
        /// <param name="viewModels"></param>
        private void ResetAllEntries(params VM[] viewModels)
        {
            Logger.InfoFormat("_");

            FastObservableCollection <VM> all = this.All as FastObservableCollection <VM>;

            all.SuspendCollectionChangeNotification();
            try
            {
                all.Clear();
                all.NotifyChanges();
                all.AddItems(viewModels);
            }
            finally
            {
                all.NotifyChanges();

                if (this.EntriesChanged != null)
                {
                    this.EntriesChanged(this, EventArgs.Empty);
                }
            }
        }