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

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

            base.RemoveItem(index);
        }
Exemple #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;
            }
        }
Exemple #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));
         }
     }
 }