move PCL project to shared

This commit is contained in:
2020-05-11 00:44:12 +08:00
parent 8b891cc692
commit 98007c98e4
11 changed files with 191 additions and 122 deletions

View File

@@ -57,57 +57,54 @@ namespace Pixiview.UI
{
return _isFullscreenDevice.Value;
}
if (Device.RuntimePlatform == Device.iOS)
#if __IOS__
try
{
try
var model = DeviceInfo.Model;
if (model == "iPhone10,3")
{
var model = DeviceInfo.Model;
if (model == "iPhone10,3")
// iPhone X
_isFullscreenDevice = true;
}
else if (model.StartsWith("iPhone"))
{
var vs = model.Substring(6).Split(',');
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{
// iPhone X
_isFullscreenDevice = true;
// iPhone X/XS/XR or iPhone 11
_isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
}
else if (model.StartsWith("iPhone"))
{
var vs = model.Substring(6).Split(',');
if (vs.Length == 2 && int.TryParse(vs[0], out int main) && int.TryParse(vs[1], out int sub))
{
// iPhone X/XS/XR or iPhone 11
_isFullscreenDevice = (main == 10 && sub >= 6) || (main > 10);
}
else
{
_isFullscreenDevice = false;
}
}
else if (model.StartsWith("iPad8,"))
{
// iPad 11-inch or 12.9-inch (3rd+)
_isFullscreenDevice = true;
}
#if DEBUG
else
{
// iPad or Simulator
var name = DeviceInfo.Name;
_isFullscreenDevice = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
_isFullscreenDevice = false;
}
#endif
}
catch (Exception ex)
else if (model.StartsWith("iPad8,"))
{
App.DebugError("device.get", $"failed to get the device model. {ex.Message}");
// iPad 11-inch or 12.9-inch (3rd+)
_isFullscreenDevice = true;
}
#if DEBUG
else
{
// iPad or Simulator
var name = DeviceInfo.Name;
_isFullscreenDevice = name.StartsWith("iPhone X")
|| name.StartsWith("iPhone 11")
|| name.StartsWith("iPad Pro (11-inch)")
|| name.StartsWith("iPad Pro (12.9-inch) (3rd generation)")
|| name.StartsWith("iPad Pro (12.9-inch) (4th generation)");
}
#endif
}
else
catch (Exception ex)
{
// TODO:
_isFullscreenDevice = false;
App.DebugError("device.get", $"failed to get the device model. {ex.Message}");
}
#else
// TODO:
_isFullscreenDevice = false;
#endif
if (_isFullscreenDevice == null)
{
_isFullscreenDevice = false;