-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindowModel.cs
More file actions
102 lines (96 loc) · 2.99 KB
/
MainWindowModel.cs
File metadata and controls
102 lines (96 loc) · 2.99 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace HHSAdvWin
{
public partial class MainWindowModel : ObservableObject
{
private readonly ZProperties properties;
public MainWindowModel(ZProperties properties)
{
this.properties = properties;
this.properties.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(ZProperties.FontSize))
{
Application.Current.Dispatcher.Invoke(() =>
{
OnPropertyChanged(nameof(FontSize));
});
}
else if (e.PropertyName == nameof(ZProperties.ThemeMode))
{
OnPropertyChanged(nameof(ThemeMode));
}
else if (e.PropertyName == nameof(ZProperties.OpeningRoll))
{
OnPropertyChanged(nameof(OpeningRoll));
}
else if (e.PropertyName == nameof(ZProperties.PlaySound))
{
OnPropertyChanged(nameof(PlaySound));
}
else if (e.PropertyName == nameof(ZProperties.WindowHeight))
{
OnPropertyChanged(nameof(WindowHeight));
}
else if (e.PropertyName == nameof(ZProperties.WindowWidth))
{
OnPropertyChanged(nameof(WindowWidth));
}
};
}
public int FontSize
{
get => properties.FontSize;
set
{
if (properties.FontSize != value)
{
properties.FontSize = value;
OnPropertyChanged(nameof(FontSize));
}
}
}
public ThemeType ThemeMode
{
get => properties.ThemeMode;
}
public bool OpeningRoll
{
get => properties.OpeningRoll;
}
public bool PlaySound
{
get => properties.PlaySound;
}
public int WindowHeight
{
get => properties.WindowHeight;
set
{
if (properties.WindowHeight != value)
{
properties.WindowHeight = value;
OnPropertyChanged(nameof(WindowHeight));
}
}
}
public int WindowWidth
{
get => properties.WindowWidth;
set
{
if (properties.WindowWidth != value)
{
properties.WindowWidth = value;
OnPropertyChanged(nameof(WindowWidth));
}
}
}
}
}