-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cpp
More file actions
135 lines (119 loc) · 3.4 KB
/
MainWindow.xaml.cpp
File metadata and controls
135 lines (119 loc) · 3.4 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include "pch.h"
#include "MainWindow.xaml.h"
#if __has_include("MainWindow.g.cpp")
#include "MainWindow.g.cpp"
#endif
using namespace winrt;
using namespace Microsoft::UI::Xaml;
using namespace Microsoft::UI::Xaml::Controls;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace winrt::VisualWinUI3::implementation
{
void MainWindow::OnDark(IInspectable const&, IInspectable const&)
{
SettingsX->GetRootElement().vv("Theme").SetValueInt(2);
SettingsX->Save();
void PostThemeChange();
PostThemeChange();
}
void MainWindow::OnLight(IInspectable const&, IInspectable const&)
{
SettingsX->GetRootElement().vv("Theme").SetValueInt(1);
SettingsX->Save();
void PostThemeChange();
PostThemeChange();
}
void MainWindow::OnDefault(IInspectable const&, IInspectable const&)
{
SettingsX->GetRootElement().vv("Theme").SetValueInt(0);
SettingsX->Save();
void PostThemeChange();
PostThemeChange();
}
void MainWindow::OnExit(IInspectable const&, IInspectable const&)
{
PostMessage((HWND)wnd(), WM_CLOSE, 0, 0);
}
void MainWindow::OnSaveAs(IInspectable const&, IInspectable const&)
{
}
void MainWindow::ItemInvoked(IInspectable, NavigationViewItemInvokedEventArgs ar)
{
auto topnv = Content().as<NavigationView>();
if (!topnv)
return;
Frame fr = topnv.FindName(L"contentFrame").as<Frame>();
if (!fr)
return;
if (ar.IsSettingsInvoked())
{
fr.Navigate(winrt::xaml_typename<winrt::VisualWinUI3::Settings>());
return;
}
auto it = ar.InvokedItemContainer().as<NavigationViewItem>();
if (!it)
return;
auto n = it.Name();
if (n == L"ViewMain")
fr.Navigate(winrt::xaml_typename<winrt::VisualWinUI3::MainPage>());
if (n == L"ViewMB")
fr.Navigate(winrt::xaml_typename<winrt::VisualWinUI3::MenuBuilder>());
/* if (n == L"ViewAudio")
fr.Navigate(winrt::xaml_typename<winrt::tsed::Audio>());
if (n == L"ViewLinks")
fr.Navigate(winrt::xaml_typename<winrt::tsed::Links>());
*/
}
void MainWindow :: NVI_ChangeLightTapped(IInspectable const& it, IInspectable const& e)
{
e;
it;
auto ct = SettingsX->GetRootElement().vv("Theme").GetValueInt(0);
if (ct == 1 || ct == 0)
SettingsX->GetRootElement().vv("Theme").SetValueInt(2);
else
SettingsX->GetRootElement().vv("Theme").SetValueInt(1);
SettingsX->Save();
void PostThemeChange();
PostThemeChange();
/* auto nt = it.as<NavigationViewItem>();
auto fly = nt.ContextFlyout();
fly.SetAttachedFlyout(nt,fly);
fly.ShowAttachedFlyout(nt);
auto tr = e.as<winrt::Microsoft::UI::Xaml::Input::TappedRoutedEventArgs>();
tr.Handled(true);
*/
}
void MainWindow::OnLoad(IInspectable, IInspectable)
{
auto topnv = Content().as<NavigationView>();
if (topnv)
{
Frame fr = topnv.FindName(L"contentFrame").as<Frame>();
if (fr)
{
fr.Navigate(winrt::xaml_typename<winrt::VisualWinUI3::MainPage>());
fr.Content().as<winrt::VisualWinUI3::MainPage>().wnd(wnd());
}
/*
topnv.KeyDown([this](IInspectable const&, Microsoft::UI::Xaml::Input::KeyRoutedEventArgs const& a)
{
auto topnv = Content().as<NavigationView>();
if (topnv)
{
Frame fr = topnv.FindName(L"contentFrame").as<Frame>();
if (fr)
{
auto co = fr.Content().try_as<winrt::VisualDML::MLGraph>();
if (co)
{
co.Key((long long)a.Key(), false);
}
}
}
});
*/
}
}
}