Fixes #202 This PR fixes code style for the project files. The Problem Different files in the project use different code style. That is not consistent and leads to harder maintenance of the project. Description of the changes: Have investigated and determined the most used code style across the given codebase Have configured IDE and applied code style to all project files. Have crafted clang-formatter config. see https://clang.llvm.org/docs/ClangFormat.html https://clang.llvm.org/docs/ClangFormatStyleOptions.html Some cases were fixed manually How changes were validated: manual/ad-hoc testing, automated testing All tests pass as before because these are only code style changes. Additional Please review, and let me know if I have any mistake in the code style. In case of any mistake, I will change the configuration and re-apply it to the project.
63 lines
2.8 KiB
C++
63 lines
2.8 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
namespace CalculatorApp
|
|
{
|
|
public
|
|
ref class WindowFrameService sealed
|
|
{
|
|
public:
|
|
Windows::UI::Xaml::Controls::Page ^ GetCurrentPage();
|
|
void SetNewFrame(_In_ Windows::UI::Xaml::Controls::Frame ^ frame);
|
|
|
|
internal :
|
|
// createdByUs means any window that we create.
|
|
// !createdByUs means the main window
|
|
static WindowFrameService
|
|
^ CreateNewWindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame ^ viewFrame, bool createdByUs, Platform::WeakReference parent);
|
|
|
|
Windows::UI::Core::CoreDispatcher ^ GetCoreDispatcher();
|
|
int GetViewId();
|
|
|
|
void RegisterOnWindowClosingHandler(std::function<void()> onWindowClosingHandler);
|
|
concurrency::task<void> HandleViewRelease();
|
|
|
|
// Throws InvalidArgumentException if a service is already registered with the specified id
|
|
void RegisterRuntimeWindowService(Windows::UI::Xaml::Interop::TypeName serviceId, _In_opt_ Platform::Object ^ service);
|
|
|
|
// Returns false if no service was registered with the specified id
|
|
bool RemoveRuntimeWindowService(Windows::UI::Xaml::Interop::TypeName serviceId);
|
|
|
|
// Throws InvalidArgumentException if no service is registered with the specified id
|
|
Platform::Object ^ ResolveRuntimeWindowService(Windows::UI::Xaml::Interop::TypeName serviceId);
|
|
|
|
// Returns nullptr if no service is registered with the specified id
|
|
_Ret_maybenull_ Platform::Object ^ TryResolveRuntimeWindowService(Windows::UI::Xaml::Interop::TypeName serviceId);
|
|
|
|
Windows::UI::Xaml::Controls::Frame ^ GetFrame();
|
|
void InvokeWindowClosingHandlers();
|
|
|
|
private:
|
|
WindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame ^ viewFrame, Platform::WeakReference parent);
|
|
void InitializeFrameService(bool createdByUs);
|
|
|
|
void OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender,
|
|
_In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e);
|
|
void OnClosed(_In_ Windows::UI::Core::CoreWindow ^ sender, _In_ Windows::UI::Core::CoreWindowEventArgs ^ args);
|
|
|
|
void LogOnViewClosed(_In_ Windows::UI::Core::CoreWindow ^ coreWindow);
|
|
|
|
private:
|
|
Platform::Agile<Windows::UI::Core::CoreWindow ^> m_currentWindow;
|
|
Platform::Agile<Windows::UI::Core::CoreDispatcher ^> m_coreDispatcher;
|
|
Windows::UI::Xaml::Controls::Frame ^ m_frame;
|
|
int m_viewId;
|
|
Platform::WeakReference m_parent;
|
|
|
|
std::unordered_map<Platform::String ^, Platform::Object ^> m_runtimeServicesMap;
|
|
std::vector<std::function<void()>> m_onWindowClosingHandlers;
|
|
};
|
|
}
|