예제 #1
0
        protected override void RemoveItem(int index)
        {
            MainApplicationListViewModel main = this[index] as MainApplicationListViewModel;

            if (main != null)
            {
                main.PropertyChanged -= OnMainPropertyChanged;
            }

            base.RemoveItem(index);
        }
예제 #2
0
        protected override void InsertItem(int index, IPreferedApplicationViewModel item)
        {
            base.InsertItem(index, item);

            MainApplicationListViewModel main = item as MainApplicationListViewModel;

            if (main != null)
            {
                main.PropertyChanged += OnMainPropertyChanged;
            }
        }
예제 #3
0
 private void OnMainPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(MainApplicationListViewModel.IsEnabled))
     {
         MainApplicationListViewModel main = (MainApplicationListViewModel)sender;
         if (main.IsEnabled)
         {
             base.InsertItem(Count, main);
         }
         else
         {
             base.RemoveItem(IndexOf(main));
         }
     }
 }