forked from QuinnDamerell/Baconit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding too much for one commit. Converting to using x:Binding for pre…
…f. Updating json.net. Updating the target platform version. Tweaking some annimations. Adding a delay load.
- Loading branch information
1 parent
7d8019b
commit 09948f7
Showing
17 changed files
with
283 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BaconBackend.DataObjects | ||
{ | ||
/// <summary> | ||
/// A helper class for objects that bind. | ||
/// </summary> | ||
public class BindableBase : INotifyPropertyChanged | ||
{ | ||
public event PropertyChangedEventHandler PropertyChanged = delegate { }; | ||
|
||
/// <summary> | ||
/// Checks if a property already matches a desired value. Sets the property and | ||
/// notifies listeners only when necessary. | ||
/// </summary> | ||
/// <typeparam name="T">Type of the property.</typeparam> | ||
/// <param name="storage">Reference to a property with both getter and setter.</param> | ||
/// <param name="value">Desired value for the property.</param> | ||
/// <param name="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.</param> | ||
/// <returns>True if the value was changed, false if the existing value matched the | ||
/// desired value.</returns> | ||
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null) | ||
{ | ||
if (object.Equals(storage, value)) | ||
{ | ||
return false; | ||
} | ||
storage = value; | ||
this.OnPropertyChanged(propertyName); | ||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Notifies listeners that a property value has changed. | ||
/// </summary> | ||
/// <param name="propertyName">Name of the property used to notify listeners. This | ||
/// value is optional and can be provided automatically when invoked from compilers | ||
/// that support <see cref="CallerMemberNameAttribute"/>.</param> | ||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null) | ||
{ | ||
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.