Skip to content

Commit

Permalink
Merge pull request #5 from ivandrofly/sdi-patch
Browse files Browse the repository at this point in the history
Simplify delegate invocation.
  • Loading branch information
judwhite authored Sep 5, 2016
2 parents 9eea9a9 + 6b63581 commit 16fd909
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 49 deletions.
4 changes: 1 addition & 3 deletions IdSharp.Tagging/APEv2/APEv2Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,7 @@ public string Language

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v1/ID3v1Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ public void Save(string path)

private void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

/// <summary>
Expand Down
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v2/Classes/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public IFrameHeader FrameHeader
/// <param name="propertyName">The name of the property.</param>
protected void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public abstract string GetFrameID(ID3v2TagVersion tagVersion);
Expand Down
6 changes: 1 addition & 5 deletions IdSharp.Tagging/ID3v2/Classes/FrameContainer.Validation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ private void ValidateAudioFileUrl()
protected void FireWarning(string propertyName, string message)
{
// TODO - Add to log
InvalidDataEventHandler tmpInvalidDataEventHandler = InvalidData;
if (tmpInvalidDataEventHandler != null)
{
tmpInvalidDataEventHandler(this, new InvalidDataEventArgs(propertyName, message));
}
InvalidData?.Invoke(this, new InvalidDataEventArgs(propertyName, message));
}
}
}
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v2/Classes/FrameContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ internal byte[] GetBytes(ID3v2TagVersion tagVersion)
/// <param name="propertyName">The property name.</param>
public void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public int Timestamp

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v2/Classes/Frames/Items/InvolvedPerson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public string Involvement

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v2/Classes/Frames/Items/LanguageItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ private set

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public long DeviationInMilliseconds

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public string Artists

private void RaisePropertyChanged(String propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public decimal Price

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public int Timestamp

private void FirePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
4 changes: 1 addition & 3 deletions IdSharp.Tagging/ID3v2/Classes/Frames/Items/TempoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ public int Timestamp

private void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
3 changes: 1 addition & 2 deletions IdSharp.Tagging/ID3v2/FrameBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public void Bind(INotifyPropertyChanged frame, string frameProperty, string tagP
frame.PropertyChanged += delegate
{
m_FrameContainer.RaisePropertyChanged(tagProperty);
if (validator != null)
validator();
validator?.Invoke();
};
}
}
Expand Down
4 changes: 1 addition & 3 deletions IdSharp.Tagging/Mpeg4Tag/Mpeg4Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ private class Atom

private void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

#region <<< Public Properties >>>
Expand Down
4 changes: 1 addition & 3 deletions IdSharp.Tagging/SimpleTag/SimpleTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ private void Read(string path)

private void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

0 comments on commit 16fd909

Please sign in to comment.