From 90a40a38a76024c35936f732f0828dccb993b9b7 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 25 Jan 2021 19:35:26 +0100 Subject: [PATCH] Add new property DisplayInfo.RefreshRate (#1505) * DisplayInfo: add a property 'RefreshRate' (#1443) * Samples: show RefreshRate on DeviceInfoPage (#1443) * Add documentation for DisplayInfo.RefreshRate (#1443) * Add the logic to read the macos refresh rate Based on xamarin-macios issue: https://github.com/xamarin/xamarin-macios/issues/9958 Copied code from: https://gist.github.com/chamons/1eae64a2e5e10cbaf18b140e92ec4ca3 * Try to guess the Hz, but fall back to 60 This is not the most correct way, but is probably good enough. If there are any better ways in future, we can just add them in or replace this logic. Co-authored-by: Matthew Leibowitz --- Samples/Samples/View/DeviceInfoPage.xaml | 1 + .../DeviceDisplay/DeviceDisplay.android.cs | 7 +-- .../DeviceDisplay/DeviceDisplay.ios.cs | 3 +- .../DeviceDisplay/DeviceDisplay.macos.cs | 13 ++++- .../DeviceDisplay/DeviceDisplay.shared.cs | 2 +- .../DeviceDisplay/DeviceDisplay.uwp.cs | 7 ++- Xamarin.Essentials/Platform/Platform.macos.cs | 52 +++++++++++++++++++ .../Types/DisplayInfo.shared.cs | 13 +++++ .../xamarin-essentials-android.xml | 2 + .../xamarin-essentials-ios.xml | 2 + .../xamarin-essentials-macos.xml | 2 + .../xamarin-essentials-tvos.xml | 2 + .../xamarin-essentials-uwp.xml | 2 + .../xamarin-essentials-watchos.xml | 2 + .../en/FrameworksIndex/xamarin-essentials.xml | 2 + docs/en/Xamarin.Essentials/DisplayInfo.xml | 48 +++++++++++++++++ 16 files changed, 153 insertions(+), 7 deletions(-) diff --git a/Samples/Samples/View/DeviceInfoPage.xaml b/Samples/Samples/View/DeviceInfoPage.xaml index a7ca78225..af212e140 100644 --- a/Samples/Samples/View/DeviceInfoPage.xaml +++ b/Samples/Samples/View/DeviceInfoPage.xaml @@ -29,6 +29,7 @@