Exemplo n.º 1
0
        private void DeleteItem(object filenameitem)
        {
            FileNameItem fni = filenameitem as FileNameItem;

            Mementor.ElementRemove(FilePaths, fni);
            FilePaths.Remove(fni);
        }
Exemplo n.º 2
0
 private void ClearUnselected()
 {
     Mementor.Batch(() =>
     {
         for (int i = FilePaths.Count - 1; i >= 0; i--)
         {
             if (!FilePaths[i].FileIsSelected)
             {
                 Mementor.ElementRemove(FilePaths, FilePaths[i]);
                 FilePaths.Remove(FilePaths[i]);
             }
         }
     });
 }
Exemplo n.º 3
0
        private static void ClassChanged(object sender, NotifyCollectionChangedEventArgs args)
        {
            switch (args.Action)
            {
            case NotifyCollectionChangedAction.Move:
                M.ElementIndexChange((Class)sender, (Student)args.OldItems[0], args.OldStartingIndex);
                Cache = new ObservableCollection <Student>((Class)sender);
                break;

            case NotifyCollectionChangedAction.Add:
            case NotifyCollectionChangedAction.Replace:
            case NotifyCollectionChangedAction.Remove:
                if (args.OldItems != null)
                {
                    foreach (var student in args.OldItems.Cast <Student>())
                    {
                        M.ElementRemove((Class)sender, student, Cache.IndexOf(student));
                        student.PropertyChanging -= StudentChanging;
                    }
                }

                if (args.NewItems != null)
                {
                    foreach (var student in args.NewItems.Cast <Student>())
                    {
                        M.ElementAdd((Class)sender, student);
                        student.PropertyChanging += StudentChanging;
                    }
                }

                Cache = new ObservableCollection <Student>((Class)sender);
                break;

            default:
                throw new NotSupportedException();
            }
        }