HDL_ON/Common/Utlis.cs
@@ -9,10 +9,10 @@
    /// </summary>
    public class Utlis
    {
        /// <summary>
        /// 全局打印
        /// </summary>
        public static void WriteLine(object mes)
      /// <summary>
      /// 全局打印
      /// </summary>
      public static void WriteLine(object mes)
        {
#if DEBUG
            Console.WriteLine(mes);
@@ -31,25 +31,26 @@
        }
      /// <summary>
        ///
        /// </summary>
        /// <param name="mes"></param>
        /// <param name="bodyView"></param>
      public static void ShowTip(String mes, View bodyView)
      /// ShowTip
      /// </summary>
      /// <param name="mes"></param>
      /// <param name="closeTime">关闭时间</param>
      public static void ShowTip(String mes, int closeTime = 2)
      {
         var tip = new Tip()
         {
            Text = mes,
            CloseTime = 1,
            CloseTime = closeTime,
            Direction = AMPopTipDirection.None
         };
         tip.Show(bodyView);
         tip.Show(MainPage.BaseView);
      }
      #region ■ 各种正则检测_______________________
      /// <summary>
      /// 用于中国大陆验证手机号正则表达式
      /// 以1开头,11位
      /// </summary>
      public static string PhoneRegexStr = "^[1][0-9]{10}$";
      /// <summary>
@@ -129,27 +130,47 @@
         {
            Regex reg = new Regex(PhoneForForeignRegexStr);
            return reg.IsMatch(phoneNumber);
         }
         //校验国内手机号
         if (phoneNumber.Length > 11)
         {
            return false;
         }
         else if (phoneNumber.Length == 11)
         {
            }
            else
            {
            //校验国内手机号
            Regex reg = new Regex(PhoneRegexStr);
            return reg.IsMatch(phoneNumber);
         }
         else
         {
            //正则表达式判断是否数字
            Regex reg = new Regex("^[0-9]*$");
            return reg.IsMatch(phoneNumber);
         }
      }
      #endregion
      /// <summary>
      /// TextButton
      /// 根据文本,计算按钮它实际的宽度
      /// </summary>
      /// <param name="btn"></param>
      /// <param name="extendWidth">补充宽度</param>
      /// <returns></returns>
      public static int GetRealWidthByTextButton(Button btn, int extendWidth = 1)
      {
         if (string.IsNullOrEmpty(btn.Text)) { return Application.GetRealWidth(extendWidth); }
         return btn.GetTextWidth() + Application.GetRealWidth(extendWidth);
      }
      /// <summary>
      /// 根据文本,计算按钮它实际的宽度
      /// </summary>
      /// <returns></returns>
      public static int GetRealWidthByText(Button btn)
      {
         if (string.IsNullOrEmpty(btn.Text)) { return Application.GetRealWidth(4); }
#if __IOS__
         //需要增加一个误差值
         return btn.GetTextWidth() + Application.GetRealWidth(8);
#else
            //需要增加一个误差值
            return btn.GetTextWidth() + Application.GetRealWidth(4);
#endif
      }
   }
}