This commit is contained in:
Tian L 2021-07-06 22:39:34 +08:00 committed by GitHub
commit cc9a46a3f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -276,3 +276,10 @@ long long CalculatorApp::ViewModel::Common::Utilities::GetConst_WINEVENT_KEYWORD
return WINEVENT_KEYWORD_RESPONSE_TIME; return WINEVENT_KEYWORD_RESPONSE_TIME;
} }
bool CalculatorApp::ViewModel::Common::Utilities::GetIntegratedDisplaySize(double* size)
{
if (SUCCEEDED(::GetIntegratedDisplaySize(size)))
return true;
return false;
}

View file

@ -719,6 +719,7 @@ namespace CalculatorApp
static Windows::UI::Xaml::Media::SolidColorBrush ^ GetContrastColor(Windows::UI::Color backgroundColor); static Windows::UI::Xaml::Media::SolidColorBrush ^ GetContrastColor(Windows::UI::Color backgroundColor);
static int GetWindowId(); static int GetWindowId();
static long long GetConst_WINEVENT_KEYWORD_RESPONSE_TIME(); static long long GetConst_WINEVENT_KEYWORD_RESPONSE_TIME();
static bool GetIntegratedDisplaySize(double* size);
}; };
} }
} }

View file

@ -9,6 +9,7 @@ using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using Windows.Foundation; using Windows.Foundation;
using Windows.Foundation.Collections; using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.Storage; using Windows.Storage;
using Windows.UI.Core; using Windows.UI.Core;
using Windows.UI.ViewManagement; using Windows.UI.ViewManagement;
@ -39,16 +40,13 @@ namespace CalculatorApp
m_model.PropertyChanged += OnAppPropertyChanged; m_model.PropertyChanged += OnAppPropertyChanged;
m_accessibilitySettings = new AccessibilitySettings(); m_accessibilitySettings = new AccessibilitySettings();
// CSHARP_MIGRAION: TODO: find another implementation for C# if(Utilities.GetIntegratedDisplaySize(out var sizeInInches))
//double sizeInInches = 0.0; {
if(sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only
//if (SUCCEEDED(GetIntegratedDisplaySize(&sizeInInches))) {
//{ DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
// if (sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only }
// { }
// DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
// }
//}
} }
public CalculatorApp.ViewModel.ApplicationViewModel Model public CalculatorApp.ViewModel.ApplicationViewModel Model