Class DisposableBindableBase
Implementation of INotifyOfDisposal with System.ComponentModel.INotifyPropertyChanged to simplify models.
Inherited Members
Namespace: MAT.Atlas.Api.Core.Presentation
Assembly: MAT.Atlas.Api.Core.dll
Syntax
public abstract class DisposableBindableBase : DisposableBase, INotifyOfDisposal, IDisposable, INotifyPropertyChanged
Remarks
This class decorates BindableBase and delegates the System.ComponentModel.INotifyPropertyChanged implementation to BindableBase.
Constructors
DisposableBindableBase()
Constructor.
Declaration
protected DisposableBindableBase()
Methods
Dispose(Boolean)
Called by Dispose() or finalization.
This method calls, in the following order:
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Has Dispose been called. |
Overrides
Remarks
This method invokes the Disposed event handler after disposal
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event.
Declaration
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(PropertyChangedEventArgs propertyChangedEventArgs)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyChangedEventArgs | propertyChangedEventArgs | The System.ComponentModel.PropertyChangedEventArgs instance containing the event data. |
OnPropertyChanged(String)
Notifies listeners that a property value has changed.
Declaration
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Name of the property used to notify listeners. This value is optional and can be provided automatically when invoked from compilers that support System.Runtime.CompilerServices.CallerMemberNameAttribute. |
Remarks
This code is been inspired from Prism Framework and then customized. See https://github.com/PrismLibrary/Prism/blob/master/Source/Prism/Mvvm/BindableBase.cs
SetProperty<T>(ref T, T, PropertyChangedEventArgs)
Checks if a property already matches a desired value. Sets the property and notifies listeners only when necessary.
Declaration
protected virtual bool SetProperty<T>(ref T storage, T value, PropertyChangedEventArgs propertyChangedEventArgs)
Parameters
Type | Name | Description |
---|---|---|
T | storage | Reference to a property with both getter and setter. |
T | value | Desired value for the property. |
System.ComponentModel.PropertyChangedEventArgs | propertyChangedEventArgs |
Returns
Type | Description |
---|---|
System.Boolean | True if the value was changed, false if the existing value matched the desired value. |
Type Parameters
Name | Description |
---|---|
T | Type of the property. |
SetProperty<T>(ref T, T, String)
Checks if a property already matches a desired value. Sets the property and notifies listeners only when necessary.
Declaration
protected virtual bool SetProperty<T>(ref T storage, T value, string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
T | storage | Reference to a property with both getter and setter. |
T | value | Desired value for the property. |
System.String | propertyName | Name of the property used to notify listeners. This value is optional and can be provided automatically when invoked from compilers that support CallerMemberName. |
Returns
Type | Description |
---|---|
System.Boolean | True if the value was changed, false if the existing value matched the desired value. |
Type Parameters
Name | Description |
---|---|
T | Type of the property. |
Events
Disposed
Occurs when this instance is disposed.
Declaration
public event EventHandler Disposed
Event Type
Type | Description |
---|---|
System.EventHandler |
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
System.ComponentModel.PropertyChangedEventHandler |