-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.xaml.cpp
41 lines (36 loc) · 1009 Bytes
/
Settings.xaml.cpp
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
#include "pch.h"
#include "Settings.xaml.h"
#if __has_include("Settings.g.cpp")
#include "Settings.g.cpp"
#endif
using namespace winrt;
using namespace winrt::Microsoft::UI::Xaml;
std::wstring PythonFolder();
bool BrowseFolder(HWND hh, const TCHAR* tit, const TCHAR* root, const TCHAR* sel, TCHAR* rv);
namespace winrt::VisualDML::implementation
{
void Settings::Refresh()
{
m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"" });
}
winrt::hstring Settings::PythonLocation()
{
return PythonFolder().c_str();
}
void Settings::PythonLocation(winrt::hstring const& value)
{
SettingsX->GetRootElement().vv("pyf").SetWideValue(value.c_str());
SettingsX->Save();
Refresh();
}
void Settings::OnPythonLocation(IInspectable const&, IInspectable const&)
{
std::vector<wchar_t> rv(10000);
auto e = PythonFolder();
SHCreateDirectory(0, e.c_str());
auto b = BrowseFolder(0, 0, 0, e.c_str(), rv.data());
if (!b)
return;
PythonLocation(rv.data());
}
}