calculator/src/Calculator/AboutFlyout.xaml.cpp
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

69 lines
2.4 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "AboutFlyout.xaml.h"
#include "CalcViewModel/Common/AppResourceProvider.h"
#include "CalcViewModel/Common/LocalizationService.h"
#include "CalcViewModel/Common/LocalizationStringUtil.h"
#include "CalcViewModel/Common/TraceLogger.h"
using namespace std;
using namespace CalculatorApp;
using namespace CalculatorApp::Common;
using namespace Platform;
using namespace Windows::ApplicationModel;
using namespace Windows::Foundation;
using namespace Windows::System;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
#ifndef BUILD_YEAR
#define BUILD_YEAR 2019
#endif
AboutFlyout::AboutFlyout()
{
auto locService = LocalizationService::GetInstance();
auto resourceLoader = AppResourceProvider::GetInstance();
InitializeComponent();
Language = locService->GetLanguage();
this->SetVersionString();
Header->Text = resourceLoader.GetResourceString("AboutButton/Content");
auto copyrightText =
LocalizationStringUtil::GetLocalizedString(resourceLoader.GetResourceString("AboutControlCopyright")->Data(), to_wstring(BUILD_YEAR).c_str());
AboutControlCopyrightRun->Text = ref new String(copyrightText.c_str());
}
void AboutFlyout::FeedbackButton_Click(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
{
PackageVersion version = Package::Current->Id->Version;
String ^ versionNumber = ref new String(L"Version ");
versionNumber = versionNumber + version.Major + "." + version.Minor + "." + version.Build + "." + version.Revision;
Launcher::LaunchUriAsync(ref new Uri("windows-feedback:?contextid=130&metadata=%7B%22Metadata%22:[%7B%22AppBuild%22:%22" + versionNumber + "%22%7D]%7D"));
}
void AboutFlyout::SetVersionString()
{
PackageVersion version = Package::Current->Id->Version;
String ^ appName = AppResourceProvider::GetInstance().GetResourceString(L"AppName");
AboutFlyoutVersion->Text = appName + L" " + version.Major + L"." + version.Minor + L"." + version.Build + L"." + version.Revision;
}
void AboutFlyout::SetDefaultFocus()
{
AboutFlyoutEULA->Focus(::FocusState::Programmatic);
}
void CalculatorApp::AboutFlyout::UserControl_Loaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
{
TraceLogger::GetInstance().LogAboutFlyoutOpened();
}