Esempio n. 1
0
 public DeviceInformationHelper()
 {
     _screenSizeProvider = _screenSizeProviderFactory.CreateScreenSizeProvider();
     _screenSizeProvider.ScreenSizeChanged += (sender, e) =>
     {
         InformationInvalidated?.Invoke(sender, e);
     };
 }
 //NOTE: This method MUST be called from the UI thread
 public static void RefreshDisplayCache()
 {
     lock (LockObject)
     {
         DisplayInformation displayInfo = null;
         try
         {
             // This can throw exceptions that aren't well documented, so catch-all and ignore
             displayInfo = DisplayInformation.GetForCurrentView();
         }
         catch (Exception e)
         {
             MobileCenterLog.Warn(MobileCenterLog.LogTag, "Could not get display information.", e);
             return;
         }
         if (_cachedScreenSize == ScreenSizeFromDisplayInfo(displayInfo))
         {
             return;
         }
         _cachedScreenSize = ScreenSizeFromDisplayInfo(displayInfo);
         MobileCenterLog.Debug(MobileCenterLog.LogTag, $"Cached screen size updated to {_cachedScreenSize}");
         InformationInvalidated?.Invoke(null, EventArgs.Empty);
     }
 }
 protected static void InvalidateInformation(object sender, EventArgs e)
 {
     InformationInvalidated?.Invoke(sender, e);
 }
 internal static void SetCountryCode(string country)
 {
     _country = country;
     InformationInvalidated?.Invoke(null, EventArgs.Empty);
 }