/// <summary>Invoked on the changing of a property value through <see cref="SetProperty"/>. The default sends the correct messages through the <see cref="PropertyChanged"/> and <see cref="INotifyPropertyChanged.PropertyChanged"/> events.</summary> /// <typeparam name="T">The type of the property value.</typeparam> /// <param name="property">The <see cref="PropertyInfo"/> of the property that's changing.</param> /// <param name="oldValue">The old value of the property.</param> /// <param name="newValue">The new value of the property.</param> /// <param name="oldValueObject">A boxed version of the old value (in <paramref name="oldValue"/>) of the property, if <paramref name="objectsSet"/> is <c>true</c>. The default implementation will set this if any events need to be raised.</param> /// <param name="newValueObject">A boxed version of the new value (in <paramref name="newValue"/>) of the property, if <paramref name="objectsSet"/> is <c>true</c>. The default implementation will set this if any events need to be raised.</param> /// <param name="objectsSet">Whether <paramref name="oldValueObject"/> and <paramref name="newValueObject"/> are actual boxed versions of <paramref name="oldValue"/> and <paramref name="newValue"/>. The default implementation sets this to <c>true</c> if it has raised any events, and boxed the values.</param> /// <exception cref="ArgumentNullException"><paramref name="property"/> is <c>null</c>.</exception> protected virtual void OnPropertyChanged <T>(PropertyInfo property, ref T oldValue, ref T newValue, ref object oldValueObject, ref object newValueObject, ref bool objectsSet) { PropertyChangedEventArgs baseEventArgs = null; RichPropertyChangedEventArgs eventArgs = null; if (PropertyChanged != null && !objectsSet) { oldValueObject = oldValue; newValueObject = newValue; objectsSet = true; } if (PropertyChanged != null) { baseEventArgs = eventArgs = new RichPropertyChangedEventArgs(property, oldValueObject, newValueObject); } else if (BasePropertyChanged != null) { baseEventArgs = new PropertyChangedEventArgs(property.Name); } if (PropertyChanged != null) { PropertyChanged.Invoke(this, eventArgs); } if (BasePropertyChanged != null) { BasePropertyChanged.Invoke(this, baseEventArgs); } }
public Help(string type = null) { InitializeComponent(); string cur = Environment.CurrentDirectory; BasePropertyChanged vm = new BasePropertyChanged(); switch (type) { case "Fractal": pdfViewer.Load("../../../Info/Fractals.pdf"); vm = new ViewModels.HelpFractalViewModel(); break; case "Color": pdfViewer.Load("../../../Info/ColorModel.pdf"); vm = new HelpColorViewModel(); break; case "Affine": pdfViewer.Load("../../../Info/Affine.pdf"); vm = new HelpAffineViewModel(); break; } DataContext = vm; }