forked from dylanbai8/AutumnBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVMMainWindow.cs
95 lines (88 loc) · 2.49 KB
/
VMMainWindow.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
84
85
86
87
88
89
90
91
92
93
94
95
/*************************************************
** auth: [email protected]
** date: 2018/8/15 19:04:29 (UTC +8:00)
** desc: ...
*************************************************/
using AutumnBox.GUI.MVVM;
using AutumnBox.GUI.Util;
using AutumnBox.GUI.Util.I18N;
using AutumnBox.GUI.Util.UI;
using System;
using System.Windows;
namespace AutumnBox.GUI.ViewModel
{
class VMMainWindow : ViewModelBase
{
public string Sentence
{
get => _sentence; set
{
_sentence = value;
RaisePropertyChanged();
}
}
private string _sentence;
public string Title
{
get
{
return _title;
}
set
{
_title = value;
RaisePropertyChanged();
}
}
private string _title;
public VMMainWindow()
{
base.RaisePropertyChangedOnDispatcher = true;
Sentence = Sentences.Next();
InitTitle();
LanguageManager.Instance.LanguageChanged += (s, e) =>
{
InitTitle();
};
AppLoader.Instance.Loaded += (s, e) =>
{
TranSelectIndex++;
};
}
private void InitTitle()
{
#if PREVIEW
Title = $"{App.Current.Resources["AppName"]}-{Self.Version.ToString(3)}-{App.Current.Resources["VersionTypePreview"]}";
#elif RELEASE
Title = $"{App.Current.Resources["AppName"]}-{Self.Version.ToString(3)}-{App.Current.Resources["VersionTypeStable"]}";
#else
Title = $"{App.Current.Resources["AppName"]}-{Self.Version.ToString(3)}-{App.Current.Resources["VersionTypeBeta"]}";
#endif
if (Self.HaveAdminPermission)
{
Title += " " + App.Current.Resources["TitleSuffixAdmin"];
}
}
public int TranSelectIndex
{
get => tranIndex; set
{
App.Current.Dispatcher.Invoke(() =>
{
tranIndex = value;
RaisePropertyChanged();
});
}
}
private int tranIndex = 0;
public ResizeMode ResizeMode
{
get => _resizeMode; set
{
_resizeMode = value;
RaisePropertyChanged();
}
}
private ResizeMode _resizeMode = ResizeMode.NoResize;
}
}