1 //********************************************************* 2 // 3 // Copyright (c) Microsoft. All rights reserved. 4 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 // 9 //********************************************************* 10 11 // 12 // MainPage.xaml.h 13 // Declaration of the MainPage.xaml class. 14 // 15 16 #pragma once 17 18 #include "pch.h" 19 #include "MainPage.g.h" 20 #include "Common\LayoutAwarePage.h" // Required by generated header 21 #include "Constants.h" 22 23 namespace SDKSample 24 { 25 public enum class NotifyType 26 { 27 StatusMessage, 28 ErrorMessage 29 }; 30 31 public ref class MainPageSizeChangedEventArgs sealed 32 { 33 public: 34 property Windows::UI::ViewManagement::ApplicationViewState ViewState 35 { get()36 Windows::UI::ViewManagement::ApplicationViewState get() 37 { 38 return viewState; 39 } 40 set(Windows::UI::ViewManagement::ApplicationViewState value)41 void set(Windows::UI::ViewManagement::ApplicationViewState value) 42 { 43 viewState = value; 44 } 45 } 46 47 private: 48 Windows::UI::ViewManagement::ApplicationViewState viewState; 49 }; 50 51 public ref class MainPage sealed 52 { 53 public: 54 MainPage(); 55 56 protected: 57 virtual void LoadState(Platform::Object^ navigationParameter, 58 Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override; 59 virtual void SaveState(Windows::Foundation::Collections::IMap<Platform::String^, Platform::Object^>^ pageState) override; 60 61 internal: 62 property bool AutoSizeInputSectionWhenSnapped 63 { get()64 bool get() 65 { 66 return autoSizeInputSectionWhenSnapped; 67 } 68 set(bool value)69 void set(bool value) 70 { 71 autoSizeInputSectionWhenSnapped = value; 72 } 73 } 74 75 property Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ LaunchArgs 76 { 77 Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ get() 78 { 79 return safe_cast<App^>(App::Current)->LaunchArgs; 80 } 81 } 82 83 void NotifyUser(Platform::String^ strMessage, NotifyType type); 84 void LoadScenario(Platform::String^ scenarioName); 85 event Windows::Foundation::EventHandler<Platform::Object^>^ ScenarioLoaded; 86 event Windows::Foundation::EventHandler<MainPageSizeChangedEventArgs^>^ MainPageResized; 87 88 private: 89 void PopulateScenarios(); 90 void InvalidateSize(); 91 void InvalidateViewState(); 92 93 Platform::Collections::Vector<Object^>^ ScenarioList; 94 Windows::UI::Xaml::Controls::Frame^ HiddenFrame; 95 void Footer_Click(Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 96 bool autoSizeInputSectionWhenSnapped; 97 98 void MainPage_SizeChanged(Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); 99 void Scenarios_SelectionChanged(Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); 100 101 internal: 102 static MainPage^ Current; 103 104 }; 105 } 106