From 631f94758c3cb42abcdda8094e77895f376eff16 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 11 一月 2021 14:53:43 +0800
Subject: [PATCH] 2021-1-12-3

---
 HDL_ON/Common/HDLCommon.cs |   89 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 79 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 2ef00d9..4238f09 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -258,11 +258,11 @@
                 {
                     Shared.Application.RunOnMainThread(() =>
                     {
-                        //璐﹀彿鍦ㄥ埆澶勭櫥闄嗭紝琚涪涓嬬嚎 璺宠浆鍒扮櫥褰曢〉闈�
-                        new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
+                        ////璐﹀彿鍦ㄥ埆澶勭櫥闄嗭紝琚涪涓嬬嚎 璺宠浆鍒扮櫥褰曢〉闈�
+                        //new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
                         //閫�鍑虹櫥褰曟搷浣�
                         CheckLogout();
-                     
+
                     });
                     return;
                 }
@@ -270,12 +270,15 @@
                 {
                     Shared.Application.RunOnMainThread(() =>
                     {
+                        GetPushMessageAction?.Invoke();
                         //鎶ヨ鎺ㄩ�佹墠寮圭獥鎻愮ず锛坢essageType鍖呭惈Alarm鍏抽敭瀛楃殑锛�
                         if (jpushMessageInfo.messageType != null && jpushMessageInfo.messageType.Contains("Alarm"))
                         {
-                            new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
+                            //鎶ヨ鎺ㄩ�佸脊绐楁彁绀�
+                            ShowAlarmPushMessage(jpushMessageInfo);
+                            //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
                         }
-                        GetPushMessageAction?.Invoke();
+                       
                     });
                     return;
                 }
@@ -287,6 +290,8 @@
         }
 
         /// <summary>
+        /// 璐﹀彿鍦ㄥ埆澶勭櫥闄嗭紝琚涪涓嬬嚎 璺宠浆鍒扮櫥褰曢〉闈�
+        /// 瑕佸湪涓荤嚎绋嬭皟鐢�
         /// 閫�鍑虹櫥褰曟搷浣�
         /// </summary>
         public void CheckLogout()
@@ -294,9 +299,12 @@
             //鏈櫥褰曚笉鐢ㄥ鐞�
             if (!UserInfo.Current.IsLogin) return;
 
-#if DEBUG
+            //璐﹀彿鍦ㄥ埆澶勭櫥闄嗭紝琚涪涓嬬嚎 璺宠浆鍒扮櫥褰曢〉闈�
+            new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
+
+//#if DEBUG
             return;
-#endif
+//#endif
 
             Logout();
         }
@@ -308,7 +316,7 @@
         {
             //鍔犺浇Loading鏁堟灉
             var waitPage = new Loading();
-            MainPage.BasePageView.AddChidren(waitPage);
+            MainPage.BaseView.AddChidren(waitPage);
             waitPage.Start(Language.StringByID(StringId.PleaseWait));
 
             new Thread(() =>
@@ -340,6 +348,57 @@
                 }
             }).Start();
         }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        ConfirmDialog alarmPushConfirmDialog;
+        /// <summary>
+        /// 鎶ヨ鎺ㄩ�佸脊绐楁彁绀�,鐐瑰嚮鏌ョ湅璺宠浆淇℃伅涓績
+        /// </summary>
+        /// <param name="jpushMessageInfo"></param>
+        public void ShowAlarmPushMessage(JPushMessageInfo jpushMessageInfo)
+        {
+            //娌$櫥褰曚笉澶勭悊
+            if (UserInfo.Current == null || !UserInfo.Current.IsLogin || MainPage.BasePageView == null)
+            {
+                return;
+            }
+
+            //璺宠浆淇℃伅涓績椤甸潰
+            Action goAction = () =>
+            {
+                //Dialog
+                alarmPushConfirmDialog = null;
+                Action backAction = () => {
+                   
+                };
+                var skipPage = new MessageCenterPage();
+                MainPage.BasePageView.AddChidren(skipPage);
+                skipPage.LoadPage(backAction);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+
+            //鍙栨秷浜嬩欢
+            Action cancelAction = () =>
+            {
+                alarmPushConfirmDialog = null;
+            };
+
+            //闃叉澶氭寮圭獥澶勭悊
+            if (alarmPushConfirmDialog == null)
+            {
+                alarmPushConfirmDialog = new ConfirmDialog();
+                alarmPushConfirmDialog.ShowDialog(Language.StringByID(StringId.Tip), jpushMessageInfo.Content, goAction, cancelAction, StringId.Cancel, StringId.LookOver);
+            }
+            else
+            {
+                alarmPushConfirmDialog.RefreshDialog(Language.StringByID(StringId.Tip), jpushMessageInfo.Content, goAction, cancelAction, StringId.Cancel, StringId.LookOver);
+
+            }
+
+        }
+
         #endregion
 
         #region 鈻� 甯哥敤鏂规硶_______________________
@@ -393,6 +452,15 @@
         public void UpdateInternetStatus(int internetStatus, bool IsEnterBackground = false)
         {
             MainPage.Log($"缃戠粶鐘舵�佸彉鍖栵紝褰撳墠缃戠粶:{internetStatus} 鏄惁鍚庡彴:{IsEnterBackground.ToString()}");
+            //缃戠粶鐘舵�佸彉鍖� 閲嶇疆缃戝叧鐘舵�侀噸鏂版悳绱�
+            Control.Ins.GatewayOnline = false;
+
+            //缃戠粶鍙樺寲锛屾柇寮�閲嶈繛涓�娆�
+            if (Control.Ins.IsRemote)
+            {
+                Control.Ins.IsRemote = false;
+                DAL.Mqtt.MqttClient.DisConnectRemote("UpdateInternetStatus", false);
+            }
 
             if (internetStatus == 0)//娌℃湁缃戠粶杩炴帴 0
             {
@@ -402,13 +470,14 @@
             }
             else if (internetStatus == 1)//3,4G鐨勭綉缁滆繛鎺� 1
             {
-                Control.Ins.SearchLoaclGateway();
                 MainPage.InternetStatus = 1;
+                Control.Ins.SearchLoaclGateway();
+                
             }
             else if (internetStatus == 2)//WiFi缃戠粶
             {
-                Control.Ins.SearchLoaclGateway();
                 MainPage.InternetStatus = 2;
+                Control.Ins.SearchLoaclGateway();
             }
         }
         #endregion

--
Gitblit v1.8.0