-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVirtualDesktopViewModel.cs
83 lines (73 loc) · 1.95 KB
/
VirtualDesktopViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using WindowsDesktop;
namespace DesktopIconHiderWPF;
public class VirtualDesktopViewModel : INotifyPropertyChanged
{
private string _name;
private Uri? _wallpaperPath;
private string _showcaseMessage;
private bool _isCurrent;
public event PropertyChangedEventHandler? PropertyChanged;
public Guid Id { get; }
public string Name
{
get => this._name;
set
{
if (this._name != value)
{
this._name = value;
this.OnPropertyChanged();
}
}
}
public Uri? WallpaperPath
{
get => this._wallpaperPath;
set
{
if (this._wallpaperPath != value)
{
this._wallpaperPath = value;
this.OnPropertyChanged();
}
}
}
public string ShowcaseMessage
{
get => this._showcaseMessage;
set
{
if (this._showcaseMessage != value)
{
this._showcaseMessage = value;
this.OnPropertyChanged();
}
}
}
public bool IsCurrent
{
get => this._isCurrent;
set
{
if (this._isCurrent != value)
{
this._isCurrent = value;
this.OnPropertyChanged();
}
}
}
public VirtualDesktopViewModel(VirtualDesktop source)
{
this._name = string.IsNullOrEmpty(source.Name) ? "(no name)" : source.Name;
this._wallpaperPath = Uri.TryCreate(source.WallpaperPath, UriKind.Absolute, out var uri) ? uri : null;
this._showcaseMessage = "";
this.Id = source.Id;
}
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}