Пример #1
0
        private void onDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            VideoItemViewModel oldModel = e.OldValue as VideoItemViewModel;

            loadObservable(oldModel, false);
            VideoItemViewModel newModel = e.NewValue as VideoItemViewModel;

            loadObservable(newModel, true);
            loadUI();
        }
Пример #2
0
 void loadObservable(VideoItemViewModel model, bool isPlus)
 {
     if (model == null)
     {
         return;
     }
     if (isPlus)
     {
         model.PropertyChanged += onPropertyChanged;
         model.PlusSignModel.PropertyChanged       += plusSignPropertyChanged;
         model.SearchedResultModel.PropertyChanged += searcherPropertyChanged;
         model.ControlViewModel.PropertyChanged    += controlPropertyChanged;
     }
     else
     {
         model.PropertyChanged -= onPropertyChanged;
         model.PlusSignModel.PropertyChanged       -= plusSignPropertyChanged;
         model.SearchedResultModel.PropertyChanged -= searcherPropertyChanged;
         model.ControlViewModel.PropertyChanged    -= controlPropertyChanged;
     }
 }