-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIdentifiantViewModel.cs
More file actions
47 lines (40 loc) · 1.31 KB
/
IdentifiantViewModel.cs
File metadata and controls
47 lines (40 loc) · 1.31 KB
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
using System.ComponentModel;
using System.Windows.Media;
using Upsilon.Apps.Passkey.GUI.WPF.Themes;
using Upsilon.Apps.Passkey.Interfaces.Models;
using Upsilon.Apps.Passkey.Interfaces.Utils;
namespace Upsilon.Apps.Passkey.GUI.WPF.ViewModels.Controls
{
public class IdentifierViewModel : INotifyPropertyChanged
{
private readonly IAccount _account;
public Brush IdentifierBackground => _account.HasChanged("Identifiers") ? DarkMode.ChangedBrush : DarkMode.UnchangedBrush2;
public string Identifier
{
get;
set
{
if (field != value)
{
field = value;
OnPropertyChanged(nameof(Identifier));
}
}
} = string.Empty;
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"{propertyName}Background"));
}
public IdentifierViewModel(IAccount account, string identifier)
{
_account = account;
Identifier = identifier;
}
public void Refresh()
{
OnPropertyChanged(nameof(IdentifierBackground));
}
}
}