From 351bdda734832d821a9764b0cde8be5d83c4ec50 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 01 十二月 2022 09:56:25 +0800 Subject: [PATCH] 2022年12月01日09:56:23 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlMessageLogic.cs | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 109 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlMessageLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlMessageLogic.cs new file mode 100644 index 0000000..4adbd6c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlMessageLogic.cs @@ -0,0 +1,109 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone +{ + /// <summary> + /// 娑堟伅鐨勯�昏緫 + /// </summary> + public class HdlMessageLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 娑堟伅鐨勯�昏緫 + /// </summary> + private static HdlMessageLogic m_Current = null; + /// <summary> + /// 娑堟伅鐨勯�昏緫 + /// </summary> + public static HdlMessageLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlMessageLogic(); + } + return m_Current; + } + } + + #endregion + + #region 鈻� 涓�鑸殑鏂规硶_________________________ + + /// <summary> + /// 鏄剧ず淇℃伅妗� + /// </summary> + /// <param name="msgType">淇℃伅绫诲瀷</param> + /// <param name="msg">淇℃伅</param> + /// <param name="action">鍗曞嚮纭鍚庢墽琛岀殑鍥炶皟鍑芥暟</param> + /// <param name="buttonText">鎸夐挳鐨勬枃鏈�</param> + /// <param name="i_waitTime">绛夊緟鏃堕棿,鍗曚綅涓虹,璁剧疆纭鎸夐挳鍦ㄥ闀挎椂闂村悗鎵嶈兘澶熺偣鍑�</param> + public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null, int i_waitTime = -1) + { + //绌哄璞℃椂锛屼笉鏄剧ず + if (string.IsNullOrEmpty(msg)) + { + return; + } + HdlThreadLogic.Current.RunMain(() => + { + var alert = new ShowMsgControl(msgType, msg, buttonText, null, i_waitTime); + if (action != null) + { + alert.ConfirmClickEvent += () => + { + try + { + //鍥炶皟鍑芥暟 + action?.Invoke(); + } + catch (Exception ex) + { + //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け + this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + + //Log鍑哄姏 + HdlLogLogic.Current.WriteLog(ex); + } + action = null; + }; + } + alert.Show(); + }); + } + + #endregion + } + + /// <summary> + /// 淇℃伅鏄剧ず鐨勭被鍨� + /// </summary> + public enum ShowMsgType + { + /// <summary> + /// 鏅�氭彁绀虹被鍨� + /// </summary> + Normal = 1, + /// <summary> + /// 纭绫诲瀷 + /// </summary> + Confirm = 2, + /// <summary> + /// 閿欒绫诲瀷 + /// </summary> + Error = 3, + /// <summary> + /// Tip绫诲瀷 + /// </summary> + Tip = 4, + /// <summary> + /// 鎻愰啋绫诲瀷 + /// </summary> + Remind = 5 + } +} -- Gitblit v1.8.0