diff --git a/Tutorial/GacUI_Layout/RichTextEmbedding/Main.cpp b/Tutorial/GacUI_Layout/RichTextEmbedding/Main.cpp index 1d01f21c..e14100d6 100644 --- a/Tutorial/GacUI_Layout/RichTextEmbedding/Main.cpp +++ b/Tutorial/GacUI_Layout/RichTextEmbedding/Main.cpp @@ -9,6 +9,15 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi return SetupWindowsDirect2DRenderer(); } +class ViewModel : public Object, public virtual demo::IViewModel +{ +public: + void OpenUrl(WString url)override + { + ShellExecute(NULL, L"OPEN", url.Buffer(), NULL, NULL, SW_MAXIMIZE); + } +}; + void GuiMain() { { @@ -17,7 +26,7 @@ void GuiMain() auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors); GetInstanceLoaderManager()->SetResource(L"Resource", resource); } - demo::MainWindow window; + demo::MainWindow window(new ViewModel); window.MoveToScreenCenter(); GetApplication()->Run(&window); } \ No newline at end of file diff --git a/Tutorial/GacUI_Layout/RichTextEmbedding/UI/MainWindow.xml b/Tutorial/GacUI_Layout/RichTextEmbedding/UI/MainWindow.xml index 2910cf35..379d7b29 100644 --- a/Tutorial/GacUI_Layout/RichTextEmbedding/UI/MainWindow.xml +++ b/Tutorial/GacUI_Layout/RichTextEmbedding/UI/MainWindow.xml @@ -1,11 +1,15 @@ + - + + + ViewModel.OpenUrl(documentViewer.ActiveHyperlinkReference); +