Skip to content

Commit

Permalink
Implement INotifyPropertyChanging/ed to VirtualDesktop.
Browse files Browse the repository at this point in the history
  • Loading branch information
mntone committed Aug 27, 2020
1 parent fd53b15 commit 3ec5e91
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/VirtualDesktop/VirtualDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ public VirtualDesktop GetRight()

private void SetNameToCache(string name)
{
if (this._name == name) return;

this.RaisePropertyChanging(nameof(this.Name));
this._name = name;
this.RaisePropertyChanged(nameof(this.Name));
}
}
}
26 changes: 26 additions & 0 deletions source/VirtualDesktop/VirtualDesktop.notification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;

namespace WindowsDesktop
{
partial class VirtualDesktop : INotifyPropertyChanging, INotifyPropertyChanged
{
/// <summary>
/// Occurs when a virtual desktop property changing.
/// </summary>
public event PropertyChangingEventHandler PropertyChanging;

private void RaisePropertyChanging([CallerMemberName] string propertyName = "")
=> PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));

/// <summary>
/// Occurs when a virtual desktop property changed.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;

private void RaisePropertyChanged([CallerMemberName] string propertyName = "")
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

0 comments on commit 3ec5e91

Please sign in to comment.