void addTrackEvent(VideoControlModel model) { if (model.RealTimeControl.TrackSource.TrackRectEvent == null) { model.RealTimeControl.TrackSource.TrackRectEvent += onTrackRect; model.RealTimeControl.TrackSource.PropertyChanged += trackSourcePropertyChanged; } }
public VideoItemViewModel() { PlusSignModel = new PlusSignViewModel(); SearchedResultModel = new SearchedResultViewModel() { AllowDrag = false }; ControlViewModel = new VideoControlModel(); ControlViewModel.PropertyChanged += ControlViewModel_PropertyChanged; PlusSignModel.PlusCommand = new DelegateCommand(_ => gotoSearch()); PropertyChanged += onPropertyChanged; IsInEditStatus = true; }
void updatePropertyChanged(VideoControlModel model, bool isLoad) { if (model != null) { if (isLoad) { addTrackEvent(model); model.RealTimeControl.PropertyChanged += RealTimeControl_PropertyChanged; model.PropertyChanged += ViewModel_PropertyChanged; VideoIdChanged += onVideoId; } else { model.RealTimeControl.TrackSource.PropertyChanged -= trackSourcePropertyChanged; model.RealTimeControl.TrackSource.TrackRectEvent -= onTrackRect; model.RealTimeControl.PropertyChanged -= RealTimeControl_PropertyChanged; model.PropertyChanged -= ViewModel_PropertyChanged; VideoIdChanged -= onVideoId; } } }