/// <summary> /// Initializes a new <see cref="ViewModelBase"/>. /// </summary> /// <param name="modelChangeNotifier">The <see cref="IModelChangeNotifier"/> that helps dispatching the /// change notifications for relevant model changes.</param> /// <param name="watchedModels">The models relevant to this viewmodel.</param> public ViewModelBase(IModelChangeNotifier modelChangeNotifier, params object[] watchedModels) { this.watchedModels = watchedModels; cachedProperties = GetRelevantProperties(); ModelChangeNotifier = modelChangeNotifier; foreach (var model in watchedModels) { ModelChangeNotifier.Subscribe(model, NotifyAllPropertyChanges); } }
/// <summary> /// Initializes a new <see cref="ModelChangeCommand"/>. /// </summary> /// <param name="modelChangeNotifier">The <see cref="IModelChangeNotifier"/> to use for /// notifying property changes.</param> /// <param name="changedModels">The relevant changed models.</param> public ModelChangeCommand(IModelChangeNotifier modelChangeNotifier, params object[] changedModels) { ModelChangeNotifier = modelChangeNotifier; this.changedModels = changedModels; }