mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
Add dual-screen support to Calculator (#1027)
This commit is contained in:
parent
980b60f271
commit
15944fcd10
27 changed files with 2411 additions and 1279 deletions
|
@ -334,6 +334,7 @@
|
|||
<ClInclude Include="StandardCalculatorViewModel.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="UnitConverterViewModel.h" />
|
||||
<ClInclude Include="Utils\DeviceFamilyHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ApplicationViewModel.cpp" />
|
||||
|
@ -374,6 +375,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="StandardCalculatorViewModel.cpp" />
|
||||
<ClCompile Include="UnitConverterViewModel.cpp" />
|
||||
<ClCompile Include="Utils\DeviceFamilyHelper.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CalcManager\CalcManager.vcxproj">
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<Filter Include="GraphingCalculator">
|
||||
<UniqueIdentifier>{cf7dca32-9727-4f98-83c3-1c0ca7dd1e0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Utils">
|
||||
<UniqueIdentifier>{68bb415f-fcb1-4759-b0a7-c5caf9d72396}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp" />
|
||||
|
@ -86,6 +89,9 @@
|
|||
<ClCompile Include="GraphingCalculator\GraphingSettingsViewModel.cpp">
|
||||
<Filter>GraphingCalculator</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils\DeviceFamilyHelper.cpp">
|
||||
<Filter>Utils</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
|
@ -199,6 +205,9 @@
|
|||
<ClInclude Include="Common\DelegateCommand.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils\DeviceFamilyHelper.h">
|
||||
<Filter>Utils</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
||||
|
|
54
src/CalcViewModel/Utils/DeviceFamilyHelper.cpp
Normal file
54
src/CalcViewModel/Utils/DeviceFamilyHelper.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#include "DeviceFamilyHelper.h"
|
||||
|
||||
using namespace CalculatorApp::ViewModel::Utils;
|
||||
using namespace Windows::System::Profile;
|
||||
|
||||
bool DeviceFamilyHelper::m_isInit{ false };
|
||||
DeviceFamily DeviceFamilyHelper::m_deviceFamily{ DeviceFamily::Unknown };
|
||||
|
||||
DeviceFamily DeviceFamilyHelper::GetDeviceFamily()
|
||||
{
|
||||
if (!m_isInit)
|
||||
{
|
||||
InitDeviceFamily();
|
||||
m_isInit = true;
|
||||
}
|
||||
return m_deviceFamily;
|
||||
}
|
||||
|
||||
void DeviceFamilyHelper::InitDeviceFamily()
|
||||
{
|
||||
auto deviceFamily = AnalyticsInfo::VersionInfo->DeviceFamily;
|
||||
if (deviceFamily == L"Windows.Desktop")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Desktop;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Core")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::WindowsCore;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Xbox")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Xbox;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Team")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::SurfaceHub;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Holographic")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::HoloLens;
|
||||
}
|
||||
else if (deviceFamily == L"Windows.Mobile")
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Mobile;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceFamily = DeviceFamily::Unknown;
|
||||
}
|
||||
}
|
31
src/CalcViewModel/Utils/DeviceFamilyHelper.h
Normal file
31
src/CalcViewModel/Utils/DeviceFamilyHelper.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace CalculatorApp::ViewModel::Utils
|
||||
{
|
||||
public enum class DeviceFamily
|
||||
{
|
||||
Unknown,
|
||||
Desktop,
|
||||
Mobile,
|
||||
Xbox,
|
||||
SurfaceHub,
|
||||
HoloLens,
|
||||
WindowsCore,
|
||||
};
|
||||
|
||||
public ref class DeviceFamilyHelper sealed
|
||||
{
|
||||
private:
|
||||
DeviceFamilyHelper() {}
|
||||
public:
|
||||
static DeviceFamily GetDeviceFamily();
|
||||
private:
|
||||
static void InitDeviceFamily();
|
||||
private:
|
||||
static bool m_isInit;
|
||||
static DeviceFamily m_deviceFamily;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue