Skip to content

Commit d3eb4e3

Browse files
committed
Implement INotifyPropertyChanging/ed to VirtualDesktop.
1 parent 696d933 commit d3eb4e3

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

source/VirtualDesktop/VirtualDesktop.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ public VirtualDesktop GetRight()
110110

111111
private void SetNameToCache(string name)
112112
{
113+
if (this._name == name) return;
114+
115+
this.RaisePropertyChanging(nameof(this.Name));
113116
this._name = name;
117+
this.RaisePropertyChanged(nameof(this.Name));
114118
}
115119

116120
#region IDisposable
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Linq;
4+
using System.Runtime.CompilerServices;
5+
6+
namespace WindowsDesktop
7+
{
8+
partial class VirtualDesktop : INotifyPropertyChanging, INotifyPropertyChanged
9+
{
10+
/// <summary>
11+
/// Occurs when a virtual desktop property changing.
12+
/// </summary>
13+
public event PropertyChangingEventHandler PropertyChanging;
14+
15+
private void RaisePropertyChanging([CallerMemberName] string propertyName = "")
16+
=> PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
17+
18+
/// <summary>
19+
/// Occurs when a virtual desktop property changed.
20+
/// </summary>
21+
public event PropertyChangedEventHandler PropertyChanged;
22+
23+
private void RaisePropertyChanged([CallerMemberName] string propertyName = "")
24+
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
25+
}
26+
}

0 commit comments

Comments
 (0)