diff --git a/misc/UWP/Platform_UWP.cpp b/misc/UWP/Platform_UWP.cpp index 9cb860ef4..b386ef17c 100644 --- a/misc/UWP/Platform_UWP.cpp +++ b/misc/UWP/Platform_UWP.cpp @@ -20,18 +20,12 @@ #include #include -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Core; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Devices::Input; -using namespace Windows::Graphics::Display; +#include +#include + +using namespace winrt; using namespace Windows::Foundation; using namespace Windows::System; -using namespace Windows::UI::Core; -using namespace Windows::UI::Input; -using namespace Windows::Security::Cryptography; -using namespace Windows::Security::Cryptography::DataProtection; -using namespace Platform; static HANDLE heap; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; @@ -532,11 +526,11 @@ cc_result Process_StartOpen(const cc_string* args) { cc_winstring raw; Platform_EncodeString(&raw, args); - auto str = ref new String(UWP_STRING(&raw)); - auto uri = ref new Uri(str); + auto str = hstring(UWP_STRING(&raw)); + auto uri = Uri(str); - auto options = ref new Windows::System::LauncherOptions(); - options->TreatAsUntrusted = true; + auto options = Windows::System::LauncherOptions(); + options.TreatAsUntrusted(true); Windows::System::Launcher::LaunchUriAsync(uri, options); return 0; } diff --git a/misc/UWP/Window_UWP.cpp b/misc/UWP/Window_UWP.cpp index ad7a9c9a6..c00f09517 100644 --- a/misc/UWP/Window_UWP.cpp +++ b/misc/UWP/Window_UWP.cpp @@ -1,4 +1,16 @@ #include "../../src/Core.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace winrt; using namespace Windows::ApplicationModel; using namespace Windows::ApplicationModel::Core; using namespace Windows::ApplicationModel::Activation; @@ -8,7 +20,6 @@ using namespace Windows::Foundation; using namespace Windows::System; using namespace Windows::UI::Core; using namespace Windows::UI::Input; -using namespace Platform; #include "../../src/_WindowBase.h" #include "../../src/String.h" @@ -192,56 +203,50 @@ void Window_DisableRawMouse(void) { void OpenFileDialog(void) { - auto picker = ref new Windows::Storage::Pickers::FileOpenPicker(); - picker->FileTypeFilter->Append(ref new String(L".jpg")); - picker->FileTypeFilter->Append(ref new String(L".jpeg")); - picker->FileTypeFilter->Append(ref new String(L".png")); + auto picker = Windows::Storage::Pickers::FileOpenPicker(); + //picker.FileTypeFilter().Append(hstring(L".jpg")); //Windows::Storage::StorageFile file = picker->PickSingleFileAsync(); } -ref class CCApp sealed : IFrameworkView +struct CCApp : implements { public: - virtual void Initialize(CoreApplicationView^ view) + // IFrameworkView interface + void Initialize(const CoreApplicationView& view) { } - virtual void Load(String^ EntryPoint) + void Load(const hstring& entryPoint) { } - virtual void Uninitialize() + void Uninitialize() { } - virtual void Run() + void Run() { - CoreWindow^ window = CoreWindow::GetForCurrentThread(); - window->Activate(); + CoreWindow& window = CoreWindow::GetForCurrentThread(); + window.Activate(); - CoreDispatcher^ dispatcher = window->Dispatcher; - dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); + CoreDispatcher& dispatcher = window.Dispatcher(); + dispatcher.ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); } - virtual void SetWindow(CoreWindow^ win) + void SetWindow(const CoreWindow& win) { } + + // IFrameworkViewSource interface + IFrameworkView CreateView() + { + return *this; + } }; -ref class CCAppSource sealed : IFrameworkViewSource +int __stdcall wWinMain(void*, void*, wchar_t** argv, int argc) { -public: - virtual IFrameworkView^ CreateView() - { - return ref new CCApp(); - } -}; - -[MTAThread] -int main(Array^ args) -{ - //init_apartment(); - auto source = ref new CCAppSource(); - CoreApplication::Run(source); + auto app = CCApp(); + CoreApplication::Run(app); } \ No newline at end of file