calculator/src/Calculator/App.xaml.h
Oleg Abrazhaev 2826d37056 Fix the project code style, as it is not consistent. (#236)
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.
2019-05-02 11:59:19 -07:00

92 lines
3.1 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// App.xaml.h
// Declaration of the App class.
//
#pragma once
#include "App.g.h"
#include "WindowFrameService.h"
namespace CalculatorApp
{
namespace ApplicationResourceKeys
{
extern Platform::StringReference AppMinWindowHeight;
extern Platform::StringReference AppMinWindowWidth;
}
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
ref class App sealed
{
public:
App();
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ args) override;
virtual void OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args) override;
internal : static bool IsAnimationEnabled();
static Platform::String ^ GetAppViewState();
static float GetAppWindowHeight();
void RemoveWindow(_In_ WindowFrameService ^ frameService);
void RemoveSecondaryWindow(_In_ WindowFrameService ^ frameService);
private:
static Windows::UI::Xaml::Controls::Frame ^ CreateFrame();
static void SetMinWindowSizeAndActivate(Windows::UI::Xaml::Controls::Frame ^ rootFrame, Windows::Foundation::Size minWindowSize);
void OnAppLaunch(Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args, Platform::String ^ argument);
void DismissedEventHandler(Windows::ApplicationModel::Activation::SplashScreen ^ sender, Platform::Object ^ e);
void RegisterDependencyProperties();
class SafeFrameWindowCreation final
{
public:
SafeFrameWindowCreation(_In_ WindowFrameService ^ frameService, App ^ parent)
: m_frameService(frameService), m_frameOpenedInWindow(false), m_parent(parent)
{
}
void SetOperationSuccess(bool success)
{
m_frameOpenedInWindow = success;
}
~SafeFrameWindowCreation()
{
if (!m_frameOpenedInWindow)
{
// Close the window as the navigation to the window didn't succeed
// and this is not visible to the user.
m_parent->RemoveWindowFromMap(m_frameService->GetViewId());
}
}
private:
WindowFrameService ^ m_frameService;
bool m_frameOpenedInWindow;
App ^ m_parent;
};
private:
concurrency::reader_writer_lock m_windowsMapLock;
std::unordered_map<int, WindowFrameService ^> m_secondaryWindows;
concurrency::task<void> SetupJumpList();
concurrency::task<void> HandleViewReleaseAndRemoveWindowFromMap(_In_ WindowFrameService ^ frameService);
void AddWindowToMap(_In_ WindowFrameService ^ frameService);
WindowFrameService ^ GetWindowFromMap(int viewId);
void RemoveWindowFromMap(int viewId);
int m_mainViewId;
bool m_preLaunched;
Windows::UI::Xaml::Controls::Primitives::Popup ^ m_aboutPopup;
static bool m_isAnimationEnabled;
};
}