forked from erikdarlingdata/PerformanceStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormatOptionRow.cs
More file actions
56 lines (43 loc) · 1.25 KB
/
FormatOptionRow.cs
File metadata and controls
56 lines (43 loc) · 1.25 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
48
49
50
51
52
53
54
55
56
using System.ComponentModel;
using System.Reflection;
namespace PlanViewer.App.Dialogs;
internal class FormatOptionRow : INotifyPropertyChanged
{
private string _currentValue = "";
private bool _boolValue;
public string Name { get; set; } = "";
public bool IsBool { get; set; }
public bool BoolValue
{
get => _boolValue;
set
{
if (_boolValue == value) return;
_boolValue = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BoolValue)));
// Keep CurrentValue in sync for serialization
if (IsBool)
{
_currentValue = value.ToString();
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentValue)));
}
}
}
public bool DefaultBoolValue { get; set; }
public string[]? ChoiceOptions { get; set; }
public bool IsChoice => ChoiceOptions != null;
public bool IsText => !IsBool && !IsChoice;
public string CurrentValue
{
get => _currentValue;
set
{
if (_currentValue == value) return;
_currentValue = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentValue)));
}
}
public string DefaultValue { get; set; } = "";
internal PropertyInfo PropertyInfo { get; set; } = null!;
public event PropertyChangedEventHandler? PropertyChanged;
}