Remove LayoutAwarePage, SuspensionManager, and other suspend-resume handling code. SuspensionManager::SaveAsync and related methods weren't actually called anywhere. I didn't attempt to remove the serialize/deserialize code at the ViewModel layer, although much of that is likely not needed either. We may decide we want to persist more state through a suspend-terminate-resume cycle (as the app might have done a long time ago). But if we decide we want that, we should not use a persistence mechanism that's closely coupled to frame navigation.
94 lines
4.3 KiB
C++
94 lines
4.3 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include "Views\Calculator.xaml.h"
|
|
#include "Views\MainPage.g.h"
|
|
#include "Views\DateCalculator.xaml.h"
|
|
#include "Views\UnitConverter.xaml.h"
|
|
#include "CalcViewModel\ApplicationViewModel.h"
|
|
#include "Views\TitleBar.xaml.h"
|
|
|
|
namespace CalculatorApp
|
|
{
|
|
namespace WUC = Windows::UI::Core;
|
|
namespace WUXI = Windows::UI::Xaml::Input;
|
|
namespace WUXD = Windows::UI::Xaml::Data;
|
|
namespace WUXC = Windows::UI::Xaml::Controls;
|
|
|
|
/// <summary>
|
|
/// A basic page that provides characteristics common to most applications.
|
|
/// </summary>
|
|
public ref class MainPage sealed
|
|
{
|
|
public:
|
|
MainPage();
|
|
property CalculatorApp::ViewModel::ApplicationViewModel^ Model
|
|
{
|
|
CalculatorApp::ViewModel::ApplicationViewModel^ get(){
|
|
return m_model;
|
|
}
|
|
}
|
|
|
|
void UnregisterEventHandlers();
|
|
|
|
void SetDefaultFocus();
|
|
void SetHeaderAutomationName();
|
|
|
|
Windows::Foundation::Collections::IObservableVector<Platform::Object^>^ CreateUIElementsForCategories(_In_ Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup^>^ categories);
|
|
|
|
protected:
|
|
void OnNavigatedTo(_In_ Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
|
|
|
|
private:
|
|
void WindowSizeChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Core::WindowSizeChangedEventArgs^ e);
|
|
void OnAppPropertyChanged(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Data::PropertyChangedEventArgs^ e);
|
|
void SetTitleBarControlColors();
|
|
void ColorValuesChanged(_In_ Windows::UI::ViewManagement::UISettings^ sender, _In_ Platform::Object^ e);
|
|
|
|
void OnNavLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
|
void OnNavPaneOpening(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
|
void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
|
void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView^ sender, _In_ Platform::Object^ args);
|
|
void OnNavSelectionChanged(_In_ Platform::Object^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs^ e);
|
|
|
|
void OnAboutButtonClick(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs^ e);
|
|
void OnAboutFlyoutOpened(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
|
void OnAboutFlyoutClosed(_In_ Platform::Object^ sender, _In_ Platform::Object^ e);
|
|
|
|
Microsoft::UI::Xaml::Controls::NavigationViewItemHeader^ CreateNavViewHeaderFromGroup(CalculatorApp::Common::NavCategoryGroup^ group);
|
|
Microsoft::UI::Xaml::Controls::NavigationViewItem^ CreateNavViewItemFromCategory(CalculatorApp::Common::NavCategory^ category);
|
|
|
|
Windows::Foundation::EventRegistrationToken m_fullscreenFlyoutClosedToken;
|
|
void OnFullscreenFlyoutClosed();
|
|
|
|
void ShowHideControls(CalculatorApp::Common::ViewMode mode);
|
|
void UpdateViewState();
|
|
void UpdatePanelViewState();
|
|
|
|
void OnPageLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
|
void OnPageUnLoaded(_In_ Platform::Object^, _In_ Windows::UI::Xaml::RoutedEventArgs^);
|
|
|
|
void PinUnpinAppBarButtonOnClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
|
|
|
|
void EnsureCalculator();
|
|
void EnsureConverter();
|
|
void EnsureDateCalculator();
|
|
void ShowAboutPage();
|
|
|
|
void AnnounceCategoryName();
|
|
|
|
CalculatorApp::Calculator^ m_calculator;
|
|
CalculatorApp::UnitConverter^ m_converter;
|
|
CalculatorApp::DateCalculator^ m_dateCalculator;
|
|
Windows::Foundation::EventRegistrationToken _windowSizeEventToken;
|
|
Windows::Foundation::EventRegistrationToken m_hardwareButtonsBackPressedToken;
|
|
Windows::Foundation::EventRegistrationToken m_colorValuesChangedToken;
|
|
CalculatorApp::ViewModel::ApplicationViewModel^ m_model;
|
|
Windows::UI::ViewManagement::UISettings^ m_uiSettings;
|
|
|
|
std::unique_ptr<CalculatorApp::Common::TitleBarHelper> m_titleBarHelper;
|
|
};
|
|
}
|