using System;
|
using UIKit;
|
|
namespace Shared
|
{
|
public class HDLUtils
|
{
|
|
public static int RectCornerTopLeft = 1;
|
public static int RectCornerTopRight = 2;
|
public static int RectCornerBottomLeft = 4;
|
public static int RectCornerBottomRight = 8;
|
|
/// <summary>
|
/// 全局打印
|
/// </summary>
|
public static void WriteLine(object mes)
|
{
|
#if DEBUG
|
Console.WriteLine (mes);
|
#endif
|
}
|
|
public static void RestartApp() {
|
|
//Com.Hdl.Widget.
|
|
BaseApplicationDelegate DD = (BaseApplicationDelegate)UIApplication.SharedApplication.Delegate;
|
DD.setHDLRootViewController();
|
}
|
|
|
public static UIColor GetUIColorWithUint(uint uintColor)
|
{
|
|
byte r, g, b, a;
|
r = (byte)(uintColor / 256 / 256 % 256);
|
g = (byte)(uintColor / 256 % 256);
|
b = (byte)(uintColor % 256);
|
a = (byte)(uintColor / 256 / 256 / 256 % 256);
|
|
return UIKit.UIColor.FromRGBA(r, g, b, a);
|
}
|
|
/// <summary>
|
/// 生成二维码
|
/// </summary>
|
public static UIImage createQRCode(string url, int size = 500)
|
{
|
//return HDLUtlisXM.CreateQRCode(url, size);
|
|
return null;
|
}
|
|
/// <summary>
|
/// 跳转打开APP或者App Store下载地址
|
/// </summary>
|
/// <param name="url"></param>
|
public static void OpenUrl(string url)
|
{
|
UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(url));
|
}
|
|
/// <summary>
|
/// 跳转打开APP
|
/// </summary>
|
/// <param name="url"></param>
|
public static bool OpenApp(string url)
|
{
|
//打开的目标App,没设置白名单 或者 没安装的会打开失败CanOpenUrl 返回false
|
if (UIApplication.SharedApplication.CanOpenUrl(new Foundation.NSUrl(url)))
|
{
|
UIApplication.SharedApplication.OpenUrl(new Foundation.NSUrl(url));
|
return true;
|
}
|
return false;
|
}
|
|
}
|
}
|