-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraryPage.xaml.cpp
More file actions
81 lines (67 loc) · 3.22 KB
/
LibraryPage.xaml.cpp
File metadata and controls
81 lines (67 loc) · 3.22 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
#include "stdafx.h"
#include "LibraryPage.xaml.h"
#if __has_include("LibraryPage.g.cpp")
#include "LibraryPage.g.cpp"
#endif
#include "App.xaml.h"
#include "Prerequisite.h"
using namespace winrt;
using namespace Microsoft::UI::Xaml;
using namespace Microsoft::UI::Xaml::Controls;
namespace winrt::SuiteInstaller::implementation
{
LibraryPage::LibraryPage()
: mContext(App::AppService().RuntimeContext())
{
this->DataContext(mContext);
}
void LibraryPage::Prerequisite_Clicked(IInspectable const & /*sender*/,
Controls::ItemClickEventArgs const & e)
{
PrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedGridAnimation", e.ClickedItem(),
L"ConnectedGrid");
PrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedAnimation", e.ClickedItem(),
L"ConnectedIcon");
PrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedTitleAnimation", e.ClickedItem(),
L"ConnectedTitle");
Frame().Navigate(xaml_typename<SuiteInstaller::PrerequisitePage>(), e.ClickedItem());
}
} // namespace winrt::SuiteInstaller::implementation
void winrt::SuiteInstaller::implementation::LibraryPage::InstallButton_Click(
winrt::Windows::Foundation::IInspectable const &,
winrt::Microsoft::UI::Xaml::RoutedEventArgs const & e)
{
auto listItem = e.OriginalSource().try_as<FrameworkElement>().Parent().as<FrameworkElement>();
auto prereq = listItem.DataContext().try_as<SuiteInstaller::Prerequisite>();
App::AppService().InstallingPrereqs().AddPrerequisite(prereq);
prereq.WaitingForInstall(true);
}
void winrt::SuiteInstaller::implementation::LibraryPage::OpenButton_Click(
winrt::Windows::Foundation::IInspectable const &,
winrt::Microsoft::UI::Xaml::RoutedEventArgs const & e)
{
auto listItem = e.OriginalSource().try_as<FrameworkElement>().Parent().as<FrameworkElement>();
auto prereq = listItem.DataContext().try_as<SuiteInstaller::Prerequisite>();
std::thread(
[this, prereq]()
{
STARTUPINFO startupInfo = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION processInfo;
std::wstring command = prereq.OpenPath().c_str();
CreateProcess(nullptr, command.data(), nullptr, nullptr, FALSE, 0, nullptr, nullptr,
&startupInfo, &processInfo);
})
.detach();
}
void winrt::SuiteInstaller::implementation::LibraryPage::InstalledPrerequisite_Clicked(
winrt::Windows::Foundation::IInspectable const &,
winrt::Microsoft::UI::Xaml::Controls::ItemClickEventArgs const & e)
{
InstalledPrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedGridAnimation",
e.ClickedItem(), L"ConnectedGrid");
InstalledPrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedAnimation",
e.ClickedItem(), L"ConnectedIcon");
InstalledPrerequisiteList().PrepareConnectedAnimation(L"ForwardConnectedTitleAnimation",
e.ClickedItem(), L"ConnectedTitle");
Frame().Navigate(xaml_typename<SuiteInstaller::PrerequisitePage>(), e.ClickedItem());
}