From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期三, 22 六月 2022 11:22:18 +0800
Subject: [PATCH] 修改引用路径

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 2783 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 1,396 insertions(+), 1,387 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
old mode 100755
new mode 100644
index d8943b3..4998bcc
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -1,1387 +1,1396 @@
-锘縰sing System;
-using Shared.Common;
-using Newtonsoft.Json;
-using Shared.Common.ResponseEntity;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// 涓汉涓績閫昏緫绫�
-    /// </summary>
-    public class UserCenterLogic
-    {
-        #region 鈻� 浜戠鎺ュ彛璁块棶_______________________
-
-        /// <summary>
-        /// 璁块棶鎸囧畾鎺ュ彛锛岃繑鍥炴槸鍚︽垚鍔�
-        /// </summary>
-        /// <returns>鏄惁鎴愬姛</returns>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
-        /// <param name="obj">涓�涓被</param>
-        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
-        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
-        public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
-        {
-            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-            var connectMode = GetHttpConnectMode(checkAuthority);
-            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
-            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
-            if (byteData == null)
-            {
-                if (setAgain == false)
-                {
-                    //褰撳墠鏃犳硶璁块棶缃戠粶
-                    ShowNotNetMsg(RequestName, listNotShowError);
-                    return false;
-                }
-                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
-                if (byteData == null)
-                {
-                    return false;
-                }
-            }
-            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
-            //妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭�
-            return CheckNotEorrorMsg(revertObj, RequestName, listNotShowError, obj);
-        }
-
-        /// <summary>
-        /// 璁块棶鎸囧畾鎺ュ彛锛岃繑鍥炵姸鎬佺爜(鍑虹幇寮傚父鏃讹紝杩斿洖 Error)
-        /// </summary>
-        /// <returns>鎺ュ彛鐨勭姸鎬佺爜(鍑虹幇寮傚父鏃讹紝杩斿洖 Error)</returns>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
-        /// <param name="obj">涓�涓被</param>
-        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
-        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
-        /// </param>
-        public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
-        {
-            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-            var connectMode = GetHttpConnectMode(checkAuthority);
-            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
-            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
-            if (byteData == null)
-            {
-                if (setAgain == false)
-                {
-                    //褰撳墠鏃犳硶璁块棶缃戠粶
-                    ShowNotNetMsg(RequestName, listNotShowError);
-                    return "Error";
-                }
-                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
-                if (byteData == null)
-                {
-                    return "Error";
-                }
-            }
-            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
-            if (revertObj == null)
-            {
-                return "Error";
-            }
-            return revertObj.StateCode;
-        }
-
-        /// <summary>
-        /// 璁块棶鎸囧畾鎺ュ彛锛屽苟杩斿洖鎺ュ彛鎶婂璞″凡缁忓簭鍒楀寲浜嗙殑瀛楃涓诧紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null
-        /// </summary>
-        /// <returns>杩斿洖锛氭帴鍙f妸瀵硅薄宸茬粡搴忓垪鍖栦簡鐨勫瓧绗︿覆锛屽瓨鍦ㄩ敊璇俊鎭椂锛岃繑鍥瀗ull</returns>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
-        /// <param name="obj">涓�涓被</param>
-        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
-        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
-        /// </param>
-        public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
-        {
-            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-            var connectMode = GetHttpConnectMode(checkAuthority);
-            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
-            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
-            if (byteData == null)
-            {
-                if (setAgain == false)
-                {
-                    //褰撳墠鏃犳硶璁块棶缃戠粶
-                    ShowNotNetMsg(RequestName, listNotShowError);
-                    return null;
-                }
-                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
-                if (byteData == null)
-                {
-                    return null;
-                }
-            }
-            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
-            //妫�娴嬮敊璇�
-            bool notError = CheckNotEorrorMsg(revertObj, RequestName, listNotShowError, obj);
-            if (notError == false)
-            {
-                return null;
-            }
-            if (revertObj == null || revertObj.ResponseData == null)
-            {
-                return null;
-            }
-            return revertObj.ResponseData.ToString();
-        }
-
-        /// <summary>
-        /// 璁块棶鎸囧畾鎺ュ彛锛屽苟鐩存帴杩斿洖鎺ュ彛杩斿洖鐨勬瘮鐗癸紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null
-        /// </summary>
-        /// <returns>杩斿洖锛氬苟鐩存帴杩斿洖鎺ュ彛杩斿洖鐨勬瘮鐗癸紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null</returns>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
-        /// <param name="obj">涓�涓被</param>
-        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
-        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
-        public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
-        {
-            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-            var connectMode = GetHttpConnectMode(checkAuthority);
-            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
-            var revertObj = GettByteResponsePack(RequestName, connectMode, obj);
-
-            if (revertObj == null)
-            {
-                if (setAgain == false)
-                {
-                    //褰撳墠鏃犳硶璁块棶缃戠粶
-                    ShowNotNetMsg(RequestName, listNotShowError);
-                    return null;
-                }
-                revertObj = ResetByteRequestHttps(RequestName, checkAuthority, obj);
-                if (revertObj == null)
-                {
-                    return null;
-                }
-            }
-            if (revertObj != null && revertObj.Length > 0)
-            {
-                if (revertObj[0] == '{' && revertObj[revertObj.Length - 1] == '}')
-                {
-                    string data2 = System.Text.Encoding.UTF8.GetString(revertObj);
-                    var data = JsonConvert.DeserializeObject<ResponsePack>(data2);
-                    if (data != null && string.IsNullOrEmpty(data.StateCode) == false)
-                    {
-                        bool notError = CheckNotEorrorMsg(data, RequestName, listNotShowError, obj);
-                        if (notError == false)
-                        {
-                            return null;
-                        }
-                    }
-                }
-            }
-            return revertObj;
-        }
-
-        /// <summary>
-        /// 绉佹湁绫诲瀷:浠庢柊鍙戦��(鎳傜殑浜鸿嚜鐒舵噦锛屽緢闅捐В閲婃竻妤�)
-        /// </summary>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
-        /// <param name="obj">涓�涓被</param>
-        /// <returns></returns>
-        private static byte[] ResetByteRequestHttps(string RequestName, bool checkAuthority, object obj)
-        {
-            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-            var connectMode = GetHttpConnectMode(checkAuthority);
-
-            byte[] responsePack = null;
-            int count = 0;
-            while (true)
-            {
-                System.Threading.Thread.Sleep(1000);
-                //璋冪敤鎺ュ彛
-                responsePack = GettByteResponsePack(RequestName, connectMode, obj);
-                if (responsePack != null)
-                {
-                    break;
-                }
-                count++;
-                if (count == 3)
-                {
-                    //鏄剧ず娌℃湁缃戠粶鐨凪sg
-                    ShowNotNetMsg(RequestName, null);
-                    break;
-                }
-            }
-            return responsePack;
-        }
-
-        /// <summary>
-        /// 鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑鍐呭
-        /// </summary>
-        /// <returns>鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑鏂囨湰鍐呭</returns>
-        /// <param name="RequestName">璁块棶鍦板潃</param>
-        /// <param name="connectMode">鎺ュ彛鐨勮繛鎺ユā寮�</param>
-        /// <param name="obj">涓�涓被</param>
-        private static byte[] GettByteResponsePack(string RequestName, HttpConnectMode connectMode, object obj)
-        {
-            try
-            {
-                //搴忓垪鍖栧璞�
-                var requestJson = JsonConvert.SerializeObject(obj);
-                //璁块棶鎺ュ彛
-                byte[] result = null;
-                if (connectMode == HttpConnectMode.Normal)
-                {
-                    //鏅�氳闂�
-                    result = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(RequestName, Encoding.UTF8.GetBytes(requestJson));
-                }
-                else if (connectMode == HttpConnectMode.Admin)
-                {
-                    //浠ョ鐞嗗憳鐨勮韩浠借闂紝鑷韩鏄垚鍛�
-                    result = CommonPage.Instance.RequestZigbeeHttpsByAdmin(RequestName, Encoding.UTF8.GetBytes(requestJson));
-                }
-                return result;
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// 妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭�,骞舵樉绀洪敊璇�
-        /// </summary>
-        /// <returns>鏄惁瀛樺湪閿欒淇℃伅</returns>
-        /// <param name="revertObj">浠庢帴鍙f帴鏀跺埌鐨勬暟鎹�</param>
-        /// <param name="RequestName">璇锋眰鎺ュ彛</param>
-        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�)</param>
-        /// <param name="pra">璇锋眰鐨勫弬鏁�</param>
-        public static bool CheckNotEorrorMsg(ResponsePack revertObj, string RequestName, List<string> listNotShowError = null, object pra = null)
-        {
-            if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true)
-            {
-                //涓嶆娴�
-                return true;
-            }
-            if (revertObj == null)
-            {
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    //缃戠粶涓嶇ǔ瀹�,璇风◢鍚庡啀璇�
-                    string msg = Language.StringByID(R.MyInternationalizationString.uNetIsUnStabilityAndDoAgain);
-                    var control = new ShowMsgControl(ShowMsgType.Tip, msg);
-                    control.Show();
-                }, ShowErrorMode.NO);
-
-                return false;
-            }
-            if (revertObj.StateCode.ToUpper() != "SUCCESS")
-            {
-                if (listNotShowError != null && listNotShowError.Contains(revertObj.StateCode) == true)
-                {
-                    //涓嶆樉绀洪敊璇�,鐒跺悗杩斿洖true
-                    return true;
-                }
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    if (HdlCheckLogic.Current.IsAccountLoginOut() == true)
-                    {
-                        //濡傛灉鐢ㄦ埛宸茬粡閫�鍑轰簡鐧婚檰,鍒欎笉澶勭悊
-                        return;
-                    }
-                    string msg = IMessageCommon.Current.GetMsgByRequestName(RequestName, revertObj, pra);
-                    if (msg != null)
-                    {
-                        var control = new ShowMsgControl(ShowMsgType.Tip, msg);
-                        control.Show();
-
-                        //鏃犳晥鐧诲綍Token
-                        if (revertObj.StateCode == "NoLogin")
-                        {
-                            ReLoginAgain(Config.Instance.Account, false);
-                        }
-                    }
-                }, ShowErrorMode.NO);
-
-                return false;
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
-        /// </summary>
-        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄�</param>
-        /// <returns></returns>
-        public static HttpConnectMode GetHttpConnectMode(bool checkAuthority)
-        {
-            if (checkAuthority == false)
-            {
-                return HttpConnectMode.Normal;
-            }
-            if (Config.Instance.Home.IsOthreShare == true)
-            {
-                return HttpConnectMode.Admin;
-            }
-            return HttpConnectMode.Normal;
-        }
-
-        /// <summary>
-        /// 鏄剧ず娌℃湁缃戠粶鐨凪sg
-        /// </summary>
-        private static void ShowNotNetMsg(string RequestName, List<string> listNotShowError)
-        {
-            if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true)
-            {
-                //涓嶆娴�
-                return;
-            }
-            //HdlLogLogic.Current.WriteLog(-1, "褰撳墠鏃犵綉缁滆繛鎺�:" + RequestName);
-
-            HdlThreadLogic.Current.RunMain(() =>
-            {
-                // 褰撳墠鏃犵綉缁滆繛鎺�,璇风‘璁ょ綉缁�
-                string msg = Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork);
-                var control = new ShowMsgControl(ShowMsgType.Tip, msg);
-                control.Show();
-            }, ShowErrorMode.NO);
-        }
-
-        #endregion
-
-        #region 鈻� 娣诲姞鐣岄潰鐩稿叧_______________________
-
-        /// <summary>
-        /// 妫�娴嬭兘鍚︽坊鍔犵敾闈�
-        /// </summary>
-        /// <returns>true:鍙互杩藉姞 false:涓嶅彲杩藉姞</returns>
-        /// <param name="form">Form</param>
-        public static bool CheckCanAddForm(CommonFormBase form)
-        {
-            //鑾峰彇鐢婚潰鑻辨枃鍚嶅瓧
-            string formId = GetFormID(form);
-
-            //浜岄噸杩藉姞涓嶅彲
-            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
-            {
-                return true;
-            }
-            //鏆傛椂杩欐牱寮勭湅鐪嬶紝濡傛灉閲嶅锛屽垯鍏抽棴鎺夊師鏉ョ殑鐣岄潰
-            var formTemp = UserCenterResourse.DicActionForm[formId];
-            formTemp.CloseForm();
-            UserCenterResourse.DicActionForm.Remove(formId);
-
-            return true;
-        }
-
-        /// <summary>
-        /// 鎶婃墦寮�鐨勭敾闈㈡坊鍔犲埌鍐呭瓨涓�
-        /// </summary>
-        /// <param name="form">Form.</param>
-        public static void AddActionForm(CommonFormBase form)
-        {
-            //鑾峰彇鐢婚潰鑻辨枃鍚嶅瓧
-            string formId = GetFormID(form);
-
-            //浜岄噸杩藉姞涓嶅彲
-            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
-            {
-                form.FormID = formId;
-                //鍐呭瓨娣诲姞
-                UserCenterResourse.DicActionForm[formId] = form;
-                //娣诲姞鐢婚潰鏃讹紝瀹冭嚜韬氨鏄縺娲荤殑鐣岄潰
-                UserCenterResourse.NowActionFormID = form.FormID;
-
-                UserCenterResourse.listActionFormId.Add(form.FormID);
-            }
-        }
-
-        /// <summary>
-        /// 浠庡垪琛ㄤ腑绉婚櫎鐢婚潰
-        /// </summary>
-        /// <param name="i_closeForm">鍏抽棴鐨勭晫闈�</param>
-        public static void RemoveActionForm(CommonFormBase i_closeForm)
-        {
-            //鑾峰彇鐢婚潰ID
-            string formId = GetFormID(i_closeForm);
-
-            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == true)
-            {
-                //绉婚櫎ID
-                UserCenterResourse.listActionFormId.Remove(formId);
-                //绉婚櫎鐢婚潰
-                UserCenterResourse.DicActionForm.Remove(formId);
-                //娓呯┖
-                UserCenterResourse.NowActionFormID = string.Empty;
-
-                var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
-                if (actionForm == null)
-                {
-                    return;
-                }
-                //濡傛灉鍏抽棴鐨勭晫闈㈡槸DialogCommonForm绫诲瀷,鍒欎笉闇�瑕佽Е鍙戞縺娲诲嚱鏁�
-                if (i_closeForm is DialogCommonForm)
-                {
-                    if (actionForm is EditorCommonForm)
-                    {
-                        UserCenterResourse.NowActionFormID = GetFormID((EditorCommonForm)actionForm);
-                    }
-                    return;
-                }
-                //鍏抽棴鐨勭晫闈负EditorCommonForm鐨勬椂鍊�
-                else if ((i_closeForm is EditorCommonForm) && (actionForm is EditorCommonForm))
-                {
-                    //鎺ヤ笅鏉ユ縺娲荤殑鐣岄潰id
-                    UserCenterResourse.NowActionFormID = GetFormID((CommonFormBase)actionForm);
-                    try
-                    {
-                        var Myform = actionForm as EditorCommonForm;
-                        //閲嶇疆宸︽粦浣胯兘
-                        Myform.ScrollEnabled = Myform.ScrollEnabled;
-                        //瑙﹀彂鐣岄潰鍐嶆婵�娲荤殑浜嬩欢
-                        int value = Myform.FormActionAgainEvent();
-                        if (value == 1)
-                        {
-                            //Log鍑哄姏
-                            HdlLogLogic.Current.WriteLog(1, Myform.FormID + " 琚縺娲�");
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        //Log鍑哄姏
-                        HdlLogLogic.Current.WriteLog(ex, "鐣岄潰閲嶆柊婵�娲诲紓甯� " + UserCenterResourse.NowActionFormID);
-                    }
-                }
-                else if (actionForm is UserView.UserPage)
-                {
-                    //娓呯┖
-                    UserCenterResourse.NowActionFormID = string.Empty;
-                    //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡
-                    var nowForm = UserView.UserPage.Instance.GetNowActionForm();
-                    nowForm?.FormActionAgainEvent();
-                }
-                else
-                {
-                    //娓呯┖
-                    UserCenterResourse.NowActionFormID = string.Empty;
-                }
-            }
-        }
-
-        /// <summary>
-        /// 鑾峰彇鐢婚潰ID
-        /// </summary>
-        /// <returns>The form name.</returns>
-        /// <param name="form">Form.</param>
-        private static string GetFormID(CommonFormBase form)
-        {
-            if (form.FormID != string.Empty)
-            {
-                return form.FormID;
-            }
-            //灏嗗懡鍚嶇┖闂村幓鎺�
-            string[] Arry = form.ToString().Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
-            string formName = Arry[Arry.Length - 1].Trim();
-            return formName;
-        }
-
-        /// <summary>
-        /// 鑾峰彇褰撳墠姝e湪婵�娲荤殑鐢婚潰
-        /// </summary>
-        /// <returns></returns>
-        public static CommonFormBase GetNowActionForm()
-        {
-            if (UserCenterResourse.DicActionForm.ContainsKey(UserCenterResourse.NowActionFormID) == true)
-            {
-                return UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID];
-            }
-            return null;
-        }
-
-        #endregion
-
-        #region 鈻� 鍒锋柊鏈湴缂撳瓨_______________________
-
-        /// <summary>
-        /// 鍒锋柊鏈湴鎵�鏈夌紦瀛�(鐩墠姝ゆ柟娉曞彧鎻愪緵缁欐仮澶嶅浠芥暟鎹娇鐢�)
-        /// </summary>
-        public static void RefreshAllMemory()
-        {
-            //鍒锋柊浣忓畢瀵硅薄
-            RefreshHomeObject();
-            //鏍规嵁妯℃澘鏂囦欢,鎭㈠鏁版嵁
-            TemplateData.TemplateCommonLogic.Current.RecoverDataByTemplateBinFile();
-            //寮哄埗鐢熸垚璁惧鍜岀綉鍏虫枃浠�
-            TemplateData.TemplateCommonLogic.Current.CreatDeviceAndGatewayFileFromMemoryByForce();
-            //鍒锋柊鏈湴缃戝叧鏂囦欢
-            HdlGatewayLogic.Current.ReFreshByLocal();
-            //鍒锋柊鏈湴璁惧
-            Common.LocalDevice.Current.ReFreshByLocal();
-            //闇�浼樺厛浜庡埛鏂版埧闂�,鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
-            HdlGatewayLogic.Current.SynchronizeDbGateway();
-            //浠庢湰鍦伴噸鏂板姞杞藉叏閮ㄧ殑鎴块棿
-            HdlRoomLogic.Current.RefreshAllRoomByLocation();
-            //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴
-            HdlThreadLogic.Current.RunThread(async () =>
-            {
-                HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
-                await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
-            }, ShowErrorMode.NO);
-        }
-
-        /// <summary>
-        /// 鍒锋柊浣忓畢瀵硅薄
-        /// </summary>
-        public static void RefreshHomeObject()
-        {
-            var home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id);
-
-            //鍒锋柊妤煎眰
-            Config.Instance.Home.FloorDics = home.FloorDics;
-            Config.Instance.Home.CurrentFloorId = string.Empty;
-            if (Config.Instance.Home.TemplateMode == -1)
-            {
-                Config.Instance.Home.TemplateMode = home.TemplateMode;
-                if (Config.Instance.Home.TemplateMode == -1)
-                {
-                    //榛樿鍒濆鍊�
-                    Config.Instance.Home.TemplateMode = 1;
-                }
-            }
-
-            Config.Instance.Home.Save(false);
-
-            //涓婚〉闇�瑕侀噸鏂板埛鏂�
-            UserView.UserPage.Instance.RefreshAllForm = true;
-        }
-
-        #endregion
-
-        #region 鈻� 閲嶆柊鐧诲綍___________________________
-
-        /// <summary>
-        /// 閲嶆柊鐧诲綍
-        /// </summary>
-        /// <param name="account">璐﹀彿</param>
-        /// <param name="noticeDb">鏄惁閫氱煡浜戠</param>
-        public static void ReLoginAgain(string account = "", bool noticeDb = true)
-        {
-            if (Config.Instance.Home.IsVirtually == true)
-            {
-                //濡傛灉鏄櫄鎷熶綇瀹�
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    //璁惧畾涓�涓椂闂�
-                    Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
-                    Config.Instance.Save();
-                    //娓呯┖褰撳墠浣忓畢id
-                    Config.Instance.HomeId = string.Empty;
-                    //鏀惰捣宸﹁彍鍗�
-                    CommonPage.Instance.CloseLeftMenu();
-                    //鍏抽棴鍏ㄩ儴寮圭獥
-                    ShowMsgControl.CloseAllMsgDialog();
-                    //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
-                    CloseAllOpenForm(null, false);
-
-                    //鏄剧ず鐧婚檰鐢婚潰
-                    var formLogin = new Login.AccountLoginForm();
-                    Shared.Common.CommonPage.Instance.AddChidren(formLogin);
-                    formLogin.ShowForm(account);
-                });
-                return;
-            }
-            UserCenterResourse.AccountOption.OldAccountId = string.Empty;
-            //鍏抽棴鎵�鏈夋帴鏀�
-            HdlGatewayReceiveLogic.Current.RemoveAllEvent();
-            //娓呴櫎鍗囩骇鍒楄〃
-            FirmwareUpdateResourse.dicUpdateList.Clear();
-
-            HdlThreadLogic.Current.RunThread(() =>
-            {
-                //妫�娴婣PP鏄惁鑳藉閫�鍑�
-                while (UserCenterResourse.AccountOption.AppCanSignout == false)
-                {
-                    System.Threading.Thread.Sleep(500);
-                }
-                //璁惧畾涓�涓椂闂�
-                Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
-                Config.Instance.Save();
-
-                //娓呯┖褰撳墠浣忓畢id
-                Config.Instance.HomeId = string.Empty;
-                HdlGatewayLogic.Current.ClearAllRealGatewayConection(false);
-
-                //鏂紑杩滅▼Mqtt杩炴帴
-                HdlThreadLogic.Current.RunThread(async () =>
-                {
-                    await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
-                }, ShowErrorMode.NO);
-
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    //鏀惰捣宸﹁彍鍗�
-                    CommonPage.Instance.CloseLeftMenu();
-                    //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
-                    CloseAllOpenForm(null, false);
-
-                    //鏄剧ず鐧婚檰鐢婚潰
-                    var formLogin = new Login.AccountLoginForm();
-                    Shared.Common.CommonPage.Instance.AddChidren(formLogin);
-                    formLogin.ShowForm(account);
-                });
-
-                if (noticeDb == true)
-                {
-                    //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
-                    var result = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
-                }
-            });
-        }
-
-        /// <summary>
-        /// 鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
-        /// </summary>
-        /// <param name="tagetFrom">鐩爣鐣岄潰,濡傛灉鎸囧畾浜嗙殑璇�,鍒欏叧闂洰鏍囩晫闈笂灞傜殑鍏ㄩ儴鐣岄潰(瀹冭嚜韬笉鍏抽棴)</param>
-        /// <param name="refreshMainPage">褰撳叧闂殑鐣岄潰杈惧埌涓婚〉鏃�,鏄惁鍒锋柊涓婚〉</param>
-        public static void CloseAllOpenForm(string tagetFrom = null, bool refreshMainPage = true)
-        {
-            while (UserView.HomePage.Instance.ChildrenCount > 0)
-            {
-                var view = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
-                //(鍥犲簳灞傛帶浠朵慨鏀逛簡, 鐖舵帶浠剁Щ闄ゆ椂, 涓嶈Е鍙戝瓙鎺т欢鐨勭Щ闄や簨浠�)
-                if (view is ViewGroup)
-                {
-                    //鍏抽棴鍔犺浇鍦╒iewGroup閲岄潰鐨勮嚜瀹氫箟鐣岄潰Form
-                    CloseViewGroupChildren((ViewGroup)view);
-                }
-
-                if (view is CommonFormBase)
-                {
-                    if (((CommonFormBase)view).FormID == tagetFrom)
-                    {
-                        //鍙叧闂埌鎸囧畾鐩爣鐣岄潰
-                        return;
-                    }
-                    ((CommonFormBase)view).CloseForm();
-                }
-                else if (view is UserView.UserPage)
-                {
-                    //鍒锋柊涓婚〉
-                    if (refreshMainPage == true)
-                    {
-                        UserView.UserPage.Instance.ReFreshControl();
-                    }
-                    return;
-                }
-                else
-                {
-                    view.RemoveFromParent();
-                }
-            }
-        }
-
-        /// <summary>
-        /// 鍏抽棴鍔犺浇鍦╒iewGroup閲岄潰鐨勮嚜瀹氫箟鐣岄潰Form(鍥犲簳灞傛帶浠朵慨鏀逛簡,鐖舵帶浠剁Щ闄ゆ椂,涓嶈Е鍙戝瓙鎺т欢鐨勭Щ闄や簨浠�)
-        /// </summary>
-        /// <param name="group"></param>
-        private static void CloseViewGroupChildren(ViewGroup group)
-        {
-            for (int i = 0; i < group.ChildrenCount; i++)
-            {
-                var view = group.GetChildren(i);
-                if (view is CommonFormBase)
-                {
-                    ((CommonFormBase)view).CloseForm();
-                    i--;
-                }
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鎷兼帴淇℃伅___________________________
-
-        /// <summary>
-        /// 鎷兼帴缃戝叧鍥炲瓒呮椂鐨勪俊鎭�
-        /// </summary>
-        /// <param name="errorMsg">閿欒淇℃伅</param>
-        /// <param name="resultData">缃戝叧杩斿洖鐨剅esultData,閲岄潰鏈夈�恊rrorMessageBase銆戣繖涓笢瑗跨殑閭g瀵硅薄</param>
-        /// <param name="strResultData">缃戝叧杩斿洖鐨剅esultData,閲岄潰鐨勩�恊rrorMessageBase銆戠殑鍊�,璁惧畾鏈夋鍊兼椂锛宺esultData鏃犳晥</param>
-        /// <param name="addBrackets">鏄惁娣诲姞鎷彿</param>
-        /// <returns></returns>
-        public static string CombineGatewayTimeOutMsg(string errorMsg, object resultData, string strResultData = null, bool addBrackets = true)
-        {
-            if (resultData == null && strResultData == null)
-            {
-                return errorMsg;
-            }
-
-            string errorMsgBase = strResultData;
-            if (errorMsgBase == null)
-            {
-                if (resultData is ReceiptGatewayResult)
-                {
-                    errorMsgBase = string.Empty;
-                    if (((ReceiptGatewayResult)resultData).ErrorMsgDiv == 0)
-                    {
-                        errorMsgBase = "鍥炲瓒呮椂";
-                    }
-                }
-                else
-                {
-                    Type myType = resultData.GetType();
-                    object errorObj = myType.InvokeMember("errorMessageBase", System.Reflection.BindingFlags.GetField, null, resultData, null);
-                    if (errorObj == null)
-                    {
-                        return errorMsg;
-                    }
-                    errorMsgBase = errorObj.ToString();
-                }
-            }
-
-            if (errorMsgBase.Contains("鍥炲瓒呮椂") == false)
-            {
-                //鍙湁鍥炲瓒呮椂鐨勬椂鍊欐墠浼氬姞涓�
-                return errorMsg;
-            }
-            errorMsg += "\r\n";
-            if (addBrackets == true)
-            {
-                //(缃戝叧鍥炲瓒呮椂,璇风◢鍚庡啀璇�)
-                return errorMsg + "(" + Language.StringByID(R.MyInternationalizationString.uGatewayResponseTimeOut) + ")";
-            }
-            else
-            {
-                //缃戝叧鍥炲瓒呮椂,璇风◢鍚庡啀璇�
-                return errorMsg + Language.StringByID(R.MyInternationalizationString.uGatewayResponseTimeOut);
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼___________
-
-        /// <summary>
-        /// 寮傛鏂规硶鎵ц(浠呴檺鍒囨崲浣忓畢鏃惰皟鐢�)锛屽埛鏂颁釜浜轰腑蹇冪殑鍐呭瓨鍙婄嚎绋�
-        /// </summary>
-        /// <param name="ShowPrompted">鏂拌拷鍔犲彉閲忥細鏄惁鏄剧ず鎻愮ず鑷姩澶囦唤鐨勭晫闈�</param>
-        /// <returns></returns>
-        public static bool InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
-        {
-            //璋冪敤杩欎釜鏂规硶,閮介渶瑕侀噸鏂板埛鏂颁富椤�
-            UserView.UserPage.Instance.RefreshAllForm = true;
-
-            //娣诲姞缃戠粶鐘舵�佺洃鍚�
-            HdlWifiLogic.Current.StartListenNetWork();
-
-            //濡傛灉鏄櫄鎷熶綇瀹�
-            if (Config.Instance.Home.IsVirtually == true)
-            {
-                //鍒濆鍖栬櫄鎷熶綇瀹呯殑涓汉涓績鐨勬暟鎹�(鍒囨崲浣忓畢浣跨敤)
-                InitUserCenterMenmoryByVirtualHome();
-                return true;
-            }
-
-            //APP缂撳瓨鍔犺浇寮�濮�
-            UserCenterResourse.AccountOption.AppCanSignout = false;
-            //杩樺師杩滅▼杩炴帴鏉冮檺鍙橀噺
-            ZigBee.Device.ZbGateway.AllowRemoteCtrl = true;
-
-            //鍙湁鍦ㄤ綇瀹匢D涓嶄竴鏍风殑鏃跺�欐墠鍋氳繖涓搷浣�
-            if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId
-                || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId)
-            {
-                //鍊熺敤涓�涓嬭繖涓彉閲�(妫�娴嬭兘鍚﹀箍鎾埌缃戝叧)
-                UserCenterResourse.DicReceiveGatewayTest = new Dictionary<string, ZigBee.Device.ZbGateway>();
-                UserCenterResourse.HideOption.CheckCanReceiveGateway = 1;
-
-                //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
-                ClearAllMemberMemory();
-
-                //鍔犺浇璐﹀彿閰嶇疆淇℃伅
-                var optionInfo = UserCenterResourse.AccountOption.Load();
-                UserCenterResourse.AccountOption = optionInfo;
-                //鍙樻洿鏍圭敤鎴峰浘鐗囩洰褰曡矾寰�
-                UserCenterResourse.AccountOption.UserPictruePath = DirNameResourse.UserPictrueDirectory;
-
-                //鍔犺浇浣忓畢閰嶇疆淇℃伅
-                UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
-
-                //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
-                HdlFileLogic.Current.CreatAllUserCenterDirectory();
-
-                //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
-                var hadNet = InitUserAccoutInfo(true);
-                //濡傛灉鏈夌綉缁滅殑璇�
-                if (hadNet == 1)
-                {
-                    //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧
-                    HdlGatewayLogic.Current.ResetComandToBindBackupGateway();
-                    //璇诲彇闅愬尶閰嶇疆
-                    HdlBackupLogic.Current.LoadHideOption();
-                    //璋冭瘯锛氬己鍒跺紑鍚悗鍙拌皟璇旳pp鍔熻兘
-                    if (UserCenterResourse.HideOption.StartDebugApp == 1)
-                    {
-                        HdlThreadLogic.Current.RunMain(() =>
-                        {
-                            var form = new HideOption.HideOptionMainForm();
-                            form.AddForm();
-                        });
-                        ProgressBar.Close(true);
-                        return false;
-                    }
-                }
-
-                //鍏抽棴鎵�鏈夋帴鏀�
-                HdlGatewayReceiveLogic.Current.RemoveAllEvent();
-                //鍒锋柊瀹夐槻涓婃姤淇℃伅
-                HdlAlarmsLogic.Current.RefreshAlarmInfo();
-
-                //淇濆瓨鐢ㄦ埛鐨勭櫥闄嗕俊鎭埌鏈湴
-                SaveUserInformationToLocation();
-
-                UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.HomeId;
-                UserCenterResourse.AccountOption.OldAccountId = Common.Config.Instance.Account;
-
-                //鍚屾鏁版嵁(浜屾璋冪敤娌″叧绯�)
-                int result = -1;
-                if (hadNet == 1)
-                {
-                    result = HdlAutoBackupLogic.SynchronizeDbAutoBackupData();
-                }
-
-                //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅
-                HdlGatewayLogic.Current.ReFreshByLocal();
-                //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅
-                LocalDevice.Current.ReFreshByLocal();
-
-                //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
-                HdlRoomLogic.Current.RefreshAllRoomByLocation();
-
-                if (hadNet == 1)
-                {
-                    //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
-                    HdlGatewayLogic.Current.SynchronizeDbGateway();
-                }
-
-                //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴
-                HdlThreadLogic.Current.RunThread(async () =>
-                {
-                    HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
-                    await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
-                }, ShowErrorMode.NO);
-
-                //鍒锋柊APP鍓嶄竴娆¢�夋嫨鐨勭綉鍏矷D(鍙互鍙嶅璋冪敤,闇�瑕佸湪缃戝叧鍒濆鍖栧畬浜嗕箣鍚庢墠鑳借皟鐢�)
-                HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
-
-                //鍔犺浇妯℃澘缂撳瓨
-                //TemplateData.TemplateCommonLogic.Current.LoadLocalTemplateMemoryData();
-
-                //0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�,杩欎釜鏃跺�欓渶瑕佹彁绀哄浠�
-                if (result == 0 && ShowPrompted == true)
-                {
-                    //寮�鍚嚜鍔ㄥ浠�
-                    HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
-                }
-                //鏄剧ず寮曞鐣岄潰
-                ShowGuideForm(result);
-
-                //鍏抽棴debug骞挎挱
-                UserCenterResourse.HideOption.CheckCanReceiveGateway = 0;
-                System.Threading.Thread.Sleep(30);
-                if (hadNet == 1)
-                {
-                    //浣忓畢鍒囨崲鏃�,妫�娴嬬綉鍏宠繛鎺ユ儏鍐�
-                    CheckGatewayConnection();
-
-                }
-                UserCenterResourse.DicReceiveGatewayTest = null;
-            }
-            //APP缂撳瓨鍔犺浇瀹屾垚
-            UserCenterResourse.AccountOption.AppCanSignout = true;
-            if (Shared.Phone.Device.Logic.Send.If_Exist == "1")
-            {
-                //浠ユ湰鍦扮姸鎬佷负涓绘墦寮�GPS鏈嶅姟
-                Application.StartGPSLocationService();
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栬櫄鎷熶綇瀹呯殑涓汉涓績鐨勬暟鎹�(鍒囨崲浣忓畢浣跨敤)
-        /// </summary>
-        private static void InitUserCenterMenmoryByVirtualHome()
-        {
-            UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.Home.Id;
-            //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
-            ClearAllMemberMemory();
-            //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
-            HdlFileLogic.Current.CreatAllUserCenterDirectory();
-            //鍏抽棴鎵�鏈夋帴鏀�
-            HdlGatewayReceiveLogic.Current.RemoveAllEvent();
-            //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅
-            HdlGatewayLogic.Current.ReFreshByLocal();
-            //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅
-            Common.LocalDevice.Current.ReFreshByLocal();
-            //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
-            HdlRoomLogic.Current.RefreshAllRoomByLocation();
-            //鍒锋柊宸﹁竟鍒锋柊鎴块棿瑙嗗浘鍒楄〃
-            HdlRoomLogic.Current.RefreshRoomListView();
-            //鍔犺浇妯℃澘缂撳瓨
-            //TemplateData.TemplateCommonLogic.Current.LoadLocalTemplateMemoryData();
-        }
-
-        /// <summary>
-        /// 娓呯┖鎵�鏈夋垚鍛樼紦瀛�
-        /// </summary>
-        private static void ClearAllMemberMemory()
-        {
-            //娑堟伅璁板綍閲嶆柊璇诲彇鍙婃娴�
-            ControlCommonResourse.ReadMessageAgain = true;
-            ControlCommonResourse.HadNewMessage = false;
-            HdlThreadLogic.Current.RunMain(() =>
-            {
-                for (int i = 0; i < ControlCommonResourse.listMessageManaContr.Count; i++)
-                {
-                    //鏄剧ず瑙掓爣鐗规晥
-                    ControlCommonResourse.listMessageManaContr[i].IsSelected = false;
-                }
-            });
-
-            //鍒囨崲浣忓畢娓呴櫎涔嬪墠閫昏緫缂撳瓨鏁版嵁;
-            Common.Logic.LogicList.Clear();
-            Common.Logic.LockLogicList.Clear();
-            Common.Logic.SoneLogicList.Clear();
-        }
-
-        /// <summary>
-        /// 浣忓畢鍒囨崲鏃�,妫�娴嬬綉鍏宠繛鎺ユ儏鍐�
-        /// </summary>
-        private static void CheckGatewayConnection()
-        {
-            try
-            {
-                bool canReceiveGw = false;
-                foreach (var gateway in UserCenterResourse.DicReceiveGatewayTest.Values)
-                {
-                    if (gateway.HomeId == Config.Instance.Home.Id)
-                    {
-                        //鑳藉鎼滅储寰楀埌缃戝叧
-                        canReceiveGw = true;
-                        break;
-                    }
-                }
-                UserCenterResourse.DicReceiveGatewayTest = null;
-                //璁剧疆杩滅▼杩炴帴鐨勫垵濮嬪��
-                ZigBee.Device.ZbGateway.IsRemote = canReceiveGw == false;
-                if (canReceiveGw == false)
-                {
-                    //濡傛灉鏄繙绋嬬殑璇�,杩藉姞绛夊緟鏃堕棿
-                    System.Threading.Thread.Sleep(1500);
-                }
-            }
-            catch { }
-        }
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅_______________
-
-        /// <summary>
-        /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒
-        /// </summary>
-        /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param>
-        /// <returns></returns>
-        private static int InitUserAccoutInfo(bool reLoad)
-        {
-            //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
-            UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
-            if (reLoad == true)
-            {
-                //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
-                UserCenterResourse.UserInfo = GetUserInformationFromLocation();
-                UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
-            }
-            if (HdlWifiLogic.Current.CanAccessHttp == false)
-            {
-                //鏃犳硶杩炴帴澶栫綉
-                return -1;
-            }
-
-            //鑾峰彇鐧诲綍璐﹀彿鐨勪俊鎭�
-            var pra = new AccountInfoPra();
-            //搴忓垪鍖栧璞�
-            var requestJson = JsonConvert.SerializeObject(pra);
-            //璁块棶鎺ュ彛
-            byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson), "POST", 4);
-            if (byteData == null)
-            {
-                return -1;
-            }
-            //妫�娴嬮敊璇�
-            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
-            if (revertObj.StateCode.ToUpper() != "SUCCESS")
-            {
-                return 2;
-            }
-
-            var userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(revertObj.ResponseData.ToString());
-            userInfo.Account = Common.Config.Instance.Account;
-            if (string.IsNullOrEmpty(userInfo.UserName) == true)
-            {
-                //娌℃湁鏄电О鐨勬椂鍊欙紝鎶婅处鍙蜂綔涓烘樀绉�
-                userInfo.UserName = Common.Config.Instance.Account;
-            }
-
-            if (Common.Config.Instance.Home.IsOthreShare == false)
-            {
-                //韬唤:绠$悊鍛�
-                userInfo.AuthorityNo = 1;
-                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.Administrator);
-            }
-            else if (Common.Config.Instance.Home.AccountType == 1)
-            {
-                //韬唤:鎴愬憳(鎷ユ湁绠$悊鍛樻潈闄�)
-                userInfo.AuthorityNo = 2;
-                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.uMemberHadActionAuthority);
-            }
-            else
-            {
-                //韬唤:鎴愬憳
-                userInfo.AuthorityNo = 3;
-                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.uMember);
-            }
-
-            //UserInfo.AuthorityNo==0浠h〃鏈湴杩樻病鏈夌敓鎴愭枃浠�,杩欎釜鏃跺�欎笉闇�瑕佸鐞�
-            if (UserCenterResourse.UserInfo.AuthorityNo != userInfo.AuthorityNo
-                && UserCenterResourse.UserInfo.AuthorityNo != 0)
-            {
-                //濡傛灉鐧婚檰鐨勮处鍙风殑鏉冮檺鍜屼笂涓�娆$殑涓嶄竴鏍�,鍒欏垹闄ゆ湰鍦拌繖涓綇瀹呭叏閮ㄧ殑鏂囦欢,浠庡ご鍐嶆潵
-                string dirPath = Config.Instance.FullPath;
-                if (System.IO.Directory.Exists(dirPath) == true)
-                {
-                    try
-                    {
-                        //鍚屾鏁版嵁鐨勫垽鏂枃浠�(浠ラ槻涓囦竴鍒犻櫎鏁翠釜鏂囦欢澶瑰け璐ョ殑鏃跺��,杩欎釜鏂囦欢琚垹鐨勮瘽,搴旇娌′粈涔堝ぇ闂)
-                        string SynchronizeFile = DirNameResourse.AutoDownLoadBackupCheckFile;
-                        //濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘�
-                        HdlFileLogic.Current.DeleteFile(SynchronizeFile);
-                        HdlFileLogic.Current.DeleteDirectory(dirPath);
-                    }
-                    catch { }
-                    //鍒涘缓浣忓畢鏂囦欢澶�
-                    Global.CreateHomeDirectory(Config.Instance.HomeId);
-                    //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
-                    HdlFileLogic.Current.CreatAllUserCenterDirectory();
-                }
-            }
-            if (string.IsNullOrEmpty(userInfo.UserName) == true)
-            {
-                //娌℃湁鏄电О鐨勮瘽,鎶婅处鍙蜂涪杩囧幓
-                userInfo.UserName = userInfo.Account;
-            }
-
-            UserCenterResourse.UserInfo = userInfo;
-            UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
-            if (UserCenterResourse.UserInfo.HeadImage != null)
-            {
-                //鍐欏叆澶村儚鍐呭
-                HdlFileLogic.Current.SaveByteToFile(UserCenterResourse.UserInfo.UserIconFile, UserCenterResourse.UserInfo.HeadImage);
-            }
-            UserCenterResourse.UserInfo.HeadImage = null;
-            //鎵嬪娍瀵嗙爜
-            UserCenterResourse.AccountOption.GestureAuthentication = UserCenterResourse.UserInfo.GesturePwd == null ? string.Empty : UserCenterResourse.UserInfo.GesturePwd;
-            UserCenterResourse.UserInfo.GesturePwd = null;
-            //瀵嗙爜楠岃瘉
-            UserCenterResourse.AccountOption.PswAuthentication = UserCenterResourse.UserInfo.StringPwd == null ? string.Empty : UserCenterResourse.UserInfo.StringPwd;
-            UserCenterResourse.UserInfo.StringPwd = null;
-            //淇濆瓨缂撳瓨
-            UserCenterResourse.AccountOption.Save();
-
-            //鍒濆鍖栫鐞嗗憳鎺у埗涓讳汉鐨勮繛鎺ュ湴鍧�(鍥犱负杩欎釜杩炴帴Token鏄笉浼氭敼鍙樼殑,鎵�浠ュ彧闇�瑕佸垵濮嬪寲涓�娆�)
-            var flage = InitAdminConnectMainInfo();
-            //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
-            UserCenterResourse.UserInfo.InitUserInfoSuccess = flage == 1;
-
-            return flage;
-        }
-
-        /// <summary>
-        /// 浠庢湰鍦拌幏鍙栫敤鎴风殑鐧婚檰淇℃伅
-        /// </summary>
-        /// <returns></returns>
-        private static UserInformation GetUserInformationFromLocation()
-        {
-            var value = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.UserInfoFile);
-            if (value == null)
-            {
-                return new UserInformation();
-            }
-            var info = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(value);
-            return info;
-        }
-
-        /// <summary>
-        /// 閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅(鏃ㄥ湪瀵瑰簲閭d竴鐬棿,缃戠粶涓嶅ソ,瀵艰嚧璇垽鐨勬儏鍐�)
-        /// </summary>
-        /// <returns></returns>
-        public static bool ReInitUserAccoutInfo()
-        {
-            //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭�
-            var result = InitUserAccoutInfo(false);
-            if (result == 1)
-            {
-                //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
-                HdlGatewayLogic.Current.SynchronizeDbGateway();
-                //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
-                UserCenterResourse.UserInfo.InitUserInfoSuccess = true;
-
-                return true;
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// 淇濆瓨鐢ㄦ埛鐨勭櫥闄嗕俊鎭埌鏈湴
-        /// </summary>
-        private static void SaveUserInformationToLocation()
-        {
-            //鍐欏叆鍐呭
-            HdlFileLogic.Current.SaveFileContent(DirNameResourse.UserInfoFile, UserCenterResourse.UserInfo);
-
-            //鎼炰竴涓嬩富浜虹殑榛樿澶村儚
-            string defultFile = IO.FileUtils.GetImageFilePath("Center/Admin.png");
-            if (defultFile == string.Empty)
-            {
-                return;
-            }
-            if (System.IO.File.Exists(UserCenterResourse.UserInfo.UserIconFile) == true)
-            {
-                return;
-            }
-            //澶嶅埗杩囧幓
-            System.IO.File.Copy(defultFile, UserCenterResourse.UserInfo.UserIconFile);
-        }
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴___________
-
-        /// <summary>
-        /// 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴涓讳汉鐨勪俊鎭� -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒
-        /// </summary>
-        /// <returns></returns>
-        private static int InitAdminConnectMainInfo()
-        {
-            if (UserCenterResourse.UserInfo.AuthorityNo != 2 && UserCenterResourse.UserInfo.AuthorityNo != 3)
-            {
-                //鏃朵唬鍙樹簡,杩欓噷绠$悊鍛樺拰鎴愬憳閮借兘璋冪敤
-                return 1;
-            }
-            var pra = new
-            {
-                CommonPage.RequestVersion,
-                LoginAccessToken = Config.Instance.Token,
-                MainAccountId = Config.Instance.Home.MainUserDistributedMark,
-                SharedHid = Config.Instance.Home.Id
-            };
-
-            //搴忓垪鍖栧璞�
-            var requestJson = JsonConvert.SerializeObject(pra);
-            //璁块棶鎺ュ彛
-            byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("App/GetSharedHomeApiControl", Encoding.UTF8.GetBytes(requestJson));
-            if (byteData == null)
-            {
-                return -1;
-            }
-            //妫�娴嬮敊璇�
-            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
-            if (revertObj.StateCode.ToUpper() != "SUCCESS")
-            {
-                return 2;
-            }
-
-            //鍒嗕韩閾炬帴
-            var info = JsonConvert.DeserializeObject<MemberAdministratorResult>(revertObj.ResponseData.ToString());
-            Config.Instance.AdminRequestBaseUrl = info.RequestBaseUrl;
-            Config.Instance.AdminRequestToken = info.RequestToken;
-
-            return 1;
-        }
-
-        #endregion
-
-        #region 鈻� 鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken____________
-
-        /// <summary>
-        /// 鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
-        /// </summary>
-        /// <returns></returns>
-        public static string GetConnectMainToken()
-        {
-            //鍚敤绠$悊鍛樻潈闄�
-            if (Config.Instance.Home.IsOthreShare == true)
-            {
-                return Config.Instance.AdminRequestToken;
-            }
-            return Config.Instance.Token;
-        }
-
-        #endregion
-
-        #region 鈻� 寮曞鐣岄潰___________________________
-
-        /// <summary>
-        /// 鏄剧ず寮曞鐣岄潰
-        /// </summary>
-        /// <param name="result">鍚屾缁撴灉 -1锛氬紓甯�   0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�  1锛氭甯稿悓姝�  2:娌℃湁鑷姩澶囦唤鏁版嵁</param>
-        private static void ShowGuideForm(int result)
-        {
-            var checkFile = DirNameResourse.GuideFile;
-            if (System.IO.File.Exists(checkFile) == true)
-            {
-                //涓嶉渶瑕佹樉绀�
-                return;
-            }
-            if (result == 2 && Config.Instance.Home.IsOthreShare == false)
-            {
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    var form = new Guide.GuideHouseForm();
-                    form.ShowFrom();
-                });
-            }
-
-            //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚寮曞)
-            var file = System.IO.File.Create(checkFile);
-            file.Close();
-        }
-
-        #endregion
-
-        #region 鈻� 16杩涘埗杞寲_________________________
-
-        /// <summary>
-        /// 灏�16杩涘埗鐨勬枃鏈炕璇戜负姝e父鏂囨湰
-        /// </summary>
-        /// <param name="hexText">16杩涘埗鐨勬枃鏈�</param>
-        /// <param name="count">浠ュ灏戜釜瀛楄妭涓轰竴缁�</param>
-        /// <returns></returns>
-        public static string TranslateHexadecimalIntoText(string hexText, int count = 2)
-        {
-            string textValue = string.Empty;
-            while (hexText.Length > 0)
-            {
-                string temp = hexText.Substring(0, count);
-                hexText = hexText.Substring(count);
-                int value = Convert.ToInt32(temp, 16);
-                textValue += ((char)value).ToString();
-            }
-            return textValue;
-        }
-
-        /// <summary>
-        /// 灏嗘枃鏈炕璇戜负16杩涘埗鐨勬枃鏈�
-        /// </summary>
-        /// <param name="text">鎸囧畾鏂囨湰</param>
-        /// <returns></returns>
-        public static string TranslateTextIntoHexadecimal(string text)
-        {
-            string textValue = string.Empty;
-            foreach (char c in text)
-            {
-                int value = Convert.ToInt32(c);
-                textValue += Convert.ToString(value, 16);
-            }
-            return textValue;
-        }
-
-        #endregion
-
-        #region 鈻� 鍔犲瘑鍜岃В瀵哶________________________
-
-        /// <summary>
-        /// 鍔犲瘑瀵嗙爜
-        /// </summary>
-        /// <param name="keys"></param>
-        /// <param name="strPsw"></param>
-        /// <returns></returns>
-        public static string EncryptPassword(string keys, string strPsw)
-        {
-            try
-            {
-                if (string.IsNullOrEmpty(strPsw) == true)
-                {
-                    return strPsw;
-                }
-                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-                byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
-                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-                var ms = new System.IO.MemoryStream();
-                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-                cs.Write(inputByteArray, 0, inputByteArray.Length);
-                cs.FlushFinalBlock();
-                StringBuilder ret = new StringBuilder();
-                foreach (byte b in ms.ToArray())
-                {
-                    ret.AppendFormat("{0:X2}", b);
-                }
-                return ret.ToString().ToLower();
-            }
-            catch { return strPsw; }
-        }
-
-        /// <summary>
-        /// 瑙e瘑瀵嗙爜
-        /// </summary>
-        /// <param name="strPsw"></param>
-        /// <returns></returns>
-        public static string DecryptPassword(string keys, string strPsw)
-        {
-            try
-            {
-                if (strPsw == string.Empty)
-                {
-                    return strPsw;
-                }
-                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-
-                byte[] inputByteArray = new byte[strPsw.Length / 2];
-                for (int x = 0; x < strPsw.Length / 2; x++)
-                {
-                    int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
-                    inputByteArray[x] = (byte)i;
-                }
-
-                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-                var ms = new System.IO.MemoryStream();
-                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-                cs.Write(inputByteArray, 0, inputByteArray.Length);
-                cs.FlushFinalBlock();
-
-                StringBuilder ret = new StringBuilder();
-
-                return System.Text.Encoding.Default.GetString(ms.ToArray());
-            }
-            catch { return strPsw; }
-        }
-        #endregion
-
-        #region 鈻� 鏃堕棿杞崲___________________________
-
-        /// <summary>
-        /// 灏唘tc鏃堕棿绫诲瀷鐨勫瓧绗︿覆,杞崲涓烘湰鍦版椂闂�
-        /// </summary>
-        /// <param name="timeText"></param>
-        /// <returns></returns>
-        public static DateTime ConvertUtcTimeToLocalTime(string timeText)
-        {
-            var utcTime = Convert.ToDateTime(timeText);
-            return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
-        }
-
-        #endregion
-    }
-}
+锘縰sing System;
+using Shared.Common;
+using Newtonsoft.Json;
+using Shared.Common.ResponseEntity;
+using System.Collections.Generic;
+using System.Text;
+using Shared.IOS.HDLFVSDK;
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 涓汉涓績閫昏緫绫�
+    /// </summary>
+    public class UserCenterLogic
+    {
+        #region 鈻� 浜戠鎺ュ彛璁块棶_______________________
+
+        /// <summary>
+        /// 璁块棶鎸囧畾鎺ュ彛锛岃繑鍥炴槸鍚︽垚鍔�
+        /// </summary>
+        /// <returns>鏄惁鎴愬姛</returns>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
+        /// <param name="obj">涓�涓被</param>
+        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
+        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
+        public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
+        {
+            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+            var connectMode = GetHttpConnectMode(checkAuthority);
+            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
+            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
+            if (byteData == null)
+            {
+                if (setAgain == false)
+                {
+                    //褰撳墠鏃犳硶璁块棶缃戠粶
+                    ShowNotNetMsg(RequestName, listNotShowError);
+                    return false;
+                }
+                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
+                if (byteData == null)
+                {
+                    return false;
+                }
+            }
+            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            //妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭�
+            return CheckNotEorrorMsg(revertObj, RequestName, listNotShowError, obj);
+        }
+
+        /// <summary>
+        /// 璁块棶鎸囧畾鎺ュ彛锛岃繑鍥炵姸鎬佺爜(鍑虹幇寮傚父鏃讹紝杩斿洖 Error)
+        /// </summary>
+        /// <returns>鎺ュ彛鐨勭姸鎬佺爜(鍑虹幇寮傚父鏃讹紝杩斿洖 Error)</returns>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
+        /// <param name="obj">涓�涓被</param>
+        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
+        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
+        /// </param>
+        public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
+        {
+            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+            var connectMode = GetHttpConnectMode(checkAuthority);
+            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
+            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
+            if (byteData == null)
+            {
+                if (setAgain == false)
+                {
+                    //褰撳墠鏃犳硶璁块棶缃戠粶
+                    ShowNotNetMsg(RequestName, listNotShowError);
+                    return "Error";
+                }
+                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
+                if (byteData == null)
+                {
+                    return "Error";
+                }
+            }
+            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            if (revertObj == null)
+            {
+                return "Error";
+            }
+            return revertObj.StateCode;
+        }
+
+        /// <summary>
+        /// 璁块棶鎸囧畾鎺ュ彛锛屽苟杩斿洖鎺ュ彛鎶婂璞″凡缁忓簭鍒楀寲浜嗙殑瀛楃涓诧紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null
+        /// </summary>
+        /// <returns>杩斿洖锛氭帴鍙f妸瀵硅薄宸茬粡搴忓垪鍖栦簡鐨勫瓧绗︿覆锛屽瓨鍦ㄩ敊璇俊鎭椂锛岃繑鍥瀗ull</returns>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
+        /// <param name="obj">涓�涓被</param>
+        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
+        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
+        /// </param>
+        public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
+        {
+            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+            var connectMode = GetHttpConnectMode(checkAuthority);
+            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
+            var byteData = GettByteResponsePack(RequestName, connectMode, obj);
+            if (byteData == null)
+            {
+                if (setAgain == false)
+                {
+                    //褰撳墠鏃犳硶璁块棶缃戠粶
+                    ShowNotNetMsg(RequestName, listNotShowError);
+                    return null;
+                }
+                byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj);
+                if (byteData == null)
+                {
+                    return null;
+                }
+            }
+            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            //妫�娴嬮敊璇�
+            bool notError = CheckNotEorrorMsg(revertObj, RequestName, listNotShowError, obj);
+            if (notError == false)
+            {
+                return null;
+            }
+            if (revertObj == null || revertObj.ResponseData == null)
+            {
+                return null;
+            }
+            return revertObj.ResponseData.ToString();
+        }
+
+        /// <summary>
+        /// 璁块棶鎸囧畾鎺ュ彛锛屽苟鐩存帴杩斿洖鎺ュ彛杩斿洖鐨勬瘮鐗癸紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null
+        /// </summary>
+        /// <returns>杩斿洖锛氬苟鐩存帴杩斿洖鎺ュ彛杩斿洖鐨勬瘮鐗癸紝瀛樺湪閿欒淇℃伅鏃讹紝杩斿洖null</returns>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
+        /// <param name="obj">涓�涓被</param>
+        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param>
+        /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param>
+        public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true)
+        {
+            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+            var connectMode = GetHttpConnectMode(checkAuthority);
+            //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁
+            var revertObj = GettByteResponsePack(RequestName, connectMode, obj);
+
+            if (revertObj == null)
+            {
+                if (setAgain == false)
+                {
+                    //褰撳墠鏃犳硶璁块棶缃戠粶
+                    ShowNotNetMsg(RequestName, listNotShowError);
+                    return null;
+                }
+                revertObj = ResetByteRequestHttps(RequestName, checkAuthority, obj);
+                if (revertObj == null)
+                {
+                    return null;
+                }
+            }
+            if (revertObj != null && revertObj.Length > 0)
+            {
+                if (revertObj[0] == '{' && revertObj[revertObj.Length - 1] == '}')
+                {
+                    string data2 = System.Text.Encoding.UTF8.GetString(revertObj);
+                    var data = JsonConvert.DeserializeObject<ResponsePack>(data2);
+                    if (data != null && string.IsNullOrEmpty(data.StateCode) == false)
+                    {
+                        bool notError = CheckNotEorrorMsg(data, RequestName, listNotShowError, obj);
+                        if (notError == false)
+                        {
+                            return null;
+                        }
+                    }
+                }
+            }
+            return revertObj;
+        }
+
+        /// <summary>
+        /// 绉佹湁绫诲瀷:浠庢柊鍙戦��(鎳傜殑浜鸿嚜鐒舵噦锛屽緢闅捐В閲婃竻妤�)
+        /// </summary>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param>
+        /// <param name="obj">涓�涓被</param>
+        /// <returns></returns>
+        private static byte[] ResetByteRequestHttps(string RequestName, bool checkAuthority, object obj)
+        {
+            //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+            var connectMode = GetHttpConnectMode(checkAuthority);
+
+            byte[] responsePack = null;
+            int count = 0;
+            while (true)
+            {
+                System.Threading.Thread.Sleep(1000);
+                //璋冪敤鎺ュ彛
+                responsePack = GettByteResponsePack(RequestName, connectMode, obj);
+                if (responsePack != null)
+                {
+                    break;
+                }
+                count++;
+                if (count == 3)
+                {
+                    //鏄剧ず娌℃湁缃戠粶鐨凪sg
+                    ShowNotNetMsg(RequestName, null);
+                    break;
+                }
+            }
+            return responsePack;
+        }
+
+        /// <summary>
+        /// 鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑鍐呭
+        /// </summary>
+        /// <returns>鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑鏂囨湰鍐呭</returns>
+        /// <param name="RequestName">璁块棶鍦板潃</param>
+        /// <param name="connectMode">鎺ュ彛鐨勮繛鎺ユā寮�</param>
+        /// <param name="obj">涓�涓被</param>
+        private static byte[] GettByteResponsePack(string RequestName, HttpConnectMode connectMode, object obj)
+        {
+            try
+            {
+                //搴忓垪鍖栧璞�
+                var requestJson = JsonConvert.SerializeObject(obj);
+                //璁块棶鎺ュ彛
+                byte[] result = null;
+                if (connectMode == HttpConnectMode.Normal)
+                {
+                    //鏅�氳闂�
+                    result = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(RequestName, Encoding.UTF8.GetBytes(requestJson));
+                }
+                else if (connectMode == HttpConnectMode.Admin)
+                {
+                    //浠ョ鐞嗗憳鐨勮韩浠借闂紝鑷韩鏄垚鍛�
+                    result = CommonPage.Instance.RequestZigbeeHttpsByAdmin(RequestName, Encoding.UTF8.GetBytes(requestJson));
+                }
+                return result;
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message);
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// 妫�娴嬫槸鍚﹀瓨鍦ㄩ敊璇俊鎭�,骞舵樉绀洪敊璇�
+        /// </summary>
+        /// <returns>鏄惁瀛樺湪閿欒淇℃伅</returns>
+        /// <param name="revertObj">浠庢帴鍙f帴鏀跺埌鐨勬暟鎹�</param>
+        /// <param name="RequestName">璇锋眰鎺ュ彛</param>
+        /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�)</param>
+        /// <param name="pra">璇锋眰鐨勫弬鏁�</param>
+        public static bool CheckNotEorrorMsg(ResponsePack revertObj, string RequestName, List<string> listNotShowError = null, object pra = null)
+        {
+            if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true)
+            {
+                //涓嶆娴�
+                return true;
+            }
+            if (revertObj == null)
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //缃戠粶涓嶇ǔ瀹�,璇风◢鍚庡啀璇�
+                    string msg = Language.StringByID(R.MyInternationalizationString.uNetIsUnStabilityAndDoAgain);
+                    var control = new ShowMsgControl(ShowMsgType.Tip, msg);
+                    control.Show();
+                }, ShowErrorMode.NO);
+
+                return false;
+            }
+            if (revertObj.StateCode.ToUpper() != "SUCCESS")
+            {
+                if (listNotShowError != null && listNotShowError.Contains(revertObj.StateCode) == true)
+                {
+                    //涓嶆樉绀洪敊璇�,鐒跺悗杩斿洖true
+                    return true;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    if (HdlCheckLogic.Current.IsAccountLoginOut() == true)
+                    {
+                        //濡傛灉鐢ㄦ埛宸茬粡閫�鍑轰簡鐧婚檰,鍒欎笉澶勭悊
+                        return;
+                    }
+                    string msg = IMessageCommon.Current.GetMsgByRequestName(RequestName, revertObj, pra);
+                    if (msg != null)
+                    {
+                        var control = new ShowMsgControl(ShowMsgType.Tip, msg);
+                        control.Show();
+
+                        //鏃犳晥鐧诲綍Token
+                        if (revertObj.StateCode == "NoLogin")
+                        {
+                            ReLoginAgain(Config.Instance.Account, false);
+                        }
+                    }
+                }, ShowErrorMode.NO);
+
+                return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮�
+        /// </summary>
+        /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄�</param>
+        /// <returns></returns>
+        public static HttpConnectMode GetHttpConnectMode(bool checkAuthority)
+        {
+            if (checkAuthority == false)
+            {
+                return HttpConnectMode.Normal;
+            }
+            if (Config.Instance.Home.IsOthreShare == true)
+            {
+                return HttpConnectMode.Admin;
+            }
+            return HttpConnectMode.Normal;
+        }
+
+        /// <summary>
+        /// 鏄剧ず娌℃湁缃戠粶鐨凪sg
+        /// </summary>
+        private static void ShowNotNetMsg(string RequestName, List<string> listNotShowError)
+        {
+            if (listNotShowError != null && listNotShowError.Contains("NotCheck") == true)
+            {
+                //涓嶆娴�
+                return;
+            }
+            //HdlLogLogic.Current.WriteLog(-1, "褰撳墠鏃犵綉缁滆繛鎺�:" + RequestName);
+
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                // 褰撳墠鏃犵綉缁滆繛鎺�,璇风‘璁ょ綉缁�
+                string msg = Language.StringByID(R.MyInternationalizationString.uNowIsDonotNetworkAndCheckNetwork);
+                var control = new ShowMsgControl(ShowMsgType.Tip, msg);
+                control.Show();
+            }, ShowErrorMode.NO);
+        }
+
+        #endregion
+
+        #region 鈻� 娣诲姞鐣岄潰鐩稿叧_______________________
+
+        /// <summary>
+        /// 妫�娴嬭兘鍚︽坊鍔犵敾闈�
+        /// </summary>
+        /// <returns>true:鍙互杩藉姞 false:涓嶅彲杩藉姞</returns>
+        /// <param name="form">Form</param>
+        public static bool CheckCanAddForm(CommonFormBase form)
+        {
+            //鑾峰彇鐢婚潰鑻辨枃鍚嶅瓧
+            string formId = GetFormID(form);
+
+            //浜岄噸杩藉姞涓嶅彲
+            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
+            {
+                return true;
+            }
+            //鏆傛椂杩欐牱寮勭湅鐪嬶紝濡傛灉閲嶅锛屽垯鍏抽棴鎺夊師鏉ョ殑鐣岄潰
+            var formTemp = UserCenterResourse.DicActionForm[formId];
+            formTemp.CloseForm();
+            UserCenterResourse.DicActionForm.Remove(formId);
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鎶婃墦寮�鐨勭敾闈㈡坊鍔犲埌鍐呭瓨涓�
+        /// </summary>
+        /// <param name="form">Form.</param>
+        public static void AddActionForm(CommonFormBase form)
+        {
+            //鑾峰彇鐢婚潰鑻辨枃鍚嶅瓧
+            string formId = GetFormID(form);
+
+            //浜岄噸杩藉姞涓嶅彲
+            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == false)
+            {
+                form.FormID = formId;
+                //鍐呭瓨娣诲姞
+                UserCenterResourse.DicActionForm[formId] = form;
+                //娣诲姞鐢婚潰鏃讹紝瀹冭嚜韬氨鏄縺娲荤殑鐣岄潰
+                UserCenterResourse.NowActionFormID = form.FormID;
+
+                UserCenterResourse.listActionFormId.Add(form.FormID);
+            }
+        }
+
+        /// <summary>
+        /// 浠庡垪琛ㄤ腑绉婚櫎鐢婚潰
+        /// </summary>
+        /// <param name="i_closeForm">鍏抽棴鐨勭晫闈�</param>
+        public static void RemoveActionForm(CommonFormBase i_closeForm)
+        {
+            //鑾峰彇鐢婚潰ID
+            string formId = GetFormID(i_closeForm);
+
+            if (UserCenterResourse.DicActionForm.ContainsKey(formId) == true)
+            {
+                //绉婚櫎ID
+                UserCenterResourse.listActionFormId.Remove(formId);
+                //绉婚櫎鐢婚潰
+                UserCenterResourse.DicActionForm.Remove(formId);
+                //娓呯┖
+                UserCenterResourse.NowActionFormID = string.Empty;
+
+                var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
+                if (actionForm == null)
+                {
+                    return;
+                }
+                //濡傛灉鍏抽棴鐨勭晫闈㈡槸DialogCommonForm绫诲瀷,鍒欎笉闇�瑕佽Е鍙戞縺娲诲嚱鏁�
+                if (i_closeForm is DialogCommonForm)
+                {
+                    if (actionForm is EditorCommonForm)
+                    {
+                        UserCenterResourse.NowActionFormID = GetFormID((EditorCommonForm)actionForm);
+                    }
+                    return;
+                }
+                //鍏抽棴鐨勭晫闈负EditorCommonForm鐨勬椂鍊�
+                else if ((i_closeForm is EditorCommonForm) && (actionForm is EditorCommonForm))
+                {
+                    //鎺ヤ笅鏉ユ縺娲荤殑鐣岄潰id
+                    UserCenterResourse.NowActionFormID = GetFormID((CommonFormBase)actionForm);
+                    try
+                    {
+                        var Myform = actionForm as EditorCommonForm;
+                        //閲嶇疆宸︽粦浣胯兘
+                        Myform.ScrollEnabled = Myform.ScrollEnabled;
+                        //瑙﹀彂鐣岄潰鍐嶆婵�娲荤殑浜嬩欢
+                        int value = Myform.FormActionAgainEvent();
+                        if (value == 1)
+                        {
+                            //Log鍑哄姏
+                            HdlLogLogic.Current.WriteLog(1, Myform.FormID + " 琚縺娲�");
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        //Log鍑哄姏
+                        HdlLogLogic.Current.WriteLog(ex, "鐣岄潰閲嶆柊婵�娲诲紓甯� " + UserCenterResourse.NowActionFormID);
+                    }
+                }
+                else if (actionForm is UserView.UserPage)
+                {
+                    //娓呯┖
+                    UserCenterResourse.NowActionFormID = string.Empty;
+                    //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡
+                    var nowForm = UserView.UserPage.Instance.GetNowActionForm();
+                    nowForm?.FormActionAgainEvent();
+                }
+                else
+                {
+                    //娓呯┖
+                    UserCenterResourse.NowActionFormID = string.Empty;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐢婚潰ID
+        /// </summary>
+        /// <returns>The form name.</returns>
+        /// <param name="form">Form.</param>
+        private static string GetFormID(CommonFormBase form)
+        {
+            if (form.FormID != string.Empty)
+            {
+                return form.FormID;
+            }
+            //灏嗗懡鍚嶇┖闂村幓鎺�
+            string[] Arry = form.ToString().Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries);
+            string formName = Arry[Arry.Length - 1].Trim();
+            return formName;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠姝e湪婵�娲荤殑鐢婚潰
+        /// </summary>
+        /// <returns></returns>
+        public static CommonFormBase GetNowActionForm()
+        {
+            if (UserCenterResourse.DicActionForm.ContainsKey(UserCenterResourse.NowActionFormID) == true)
+            {
+                return UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID];
+            }
+            return null;
+        }
+
+        #endregion
+
+        #region 鈻� 鍒锋柊鏈湴缂撳瓨_______________________
+
+        /// <summary>
+        /// 鍒锋柊鏈湴鎵�鏈夌紦瀛�(鐩墠姝ゆ柟娉曞彧鎻愪緵缁欐仮澶嶅浠芥暟鎹娇鐢�)
+        /// </summary>
+        public static void RefreshAllMemory()
+        {
+            //鍒锋柊浣忓畢瀵硅薄
+            RefreshHomeObject();
+            //鏍规嵁妯℃澘鏂囦欢,鎭㈠鏁版嵁
+            TemplateData.TemplateCommonLogic.Current.RecoverDataByTemplateBinFile();
+            //寮哄埗鐢熸垚璁惧鍜岀綉鍏虫枃浠�
+            TemplateData.TemplateCommonLogic.Current.CreatDeviceAndGatewayFileFromMemoryByForce();
+            //鍒锋柊鏈湴缃戝叧鏂囦欢
+            HdlGatewayLogic.Current.ReFreshByLocal();
+            //鍒锋柊鏈湴璁惧
+            Common.LocalDevice.Current.ReFreshByLocal();
+            //闇�浼樺厛浜庡埛鏂版埧闂�,鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
+            HdlGatewayLogic.Current.SynchronizeDbGateway();
+            //浠庢湰鍦伴噸鏂板姞杞藉叏閮ㄧ殑鎴块棿
+            HdlRoomLogic.Current.RefreshAllRoomByLocation();
+            //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
+                await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
+            }, ShowErrorMode.NO);
+        }
+
+        /// <summary>
+        /// 鍒锋柊浣忓畢瀵硅薄
+        /// </summary>
+        public static void RefreshHomeObject()
+        {
+            var home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id);
+
+            //鍒锋柊妤煎眰
+            Config.Instance.Home.FloorDics = home.FloorDics;
+            Config.Instance.Home.CurrentFloorId = string.Empty;
+            if (Config.Instance.Home.TemplateMode == -1)
+            {
+                Config.Instance.Home.TemplateMode = home.TemplateMode;
+                if (Config.Instance.Home.TemplateMode == -1)
+                {
+                    //榛樿鍒濆鍊�
+                    Config.Instance.Home.TemplateMode = 1;
+                }
+            }
+
+            Config.Instance.Home.Save(false);
+
+            //涓婚〉闇�瑕侀噸鏂板埛鏂�
+            UserView.UserPage.Instance.RefreshAllForm = true;
+        }
+
+        #endregion
+
+        #region 鈻� 閲嶆柊鐧诲綍___________________________
+
+        /// <summary>
+        /// 閲嶆柊鐧诲綍
+        /// </summary>
+        /// <param name="account">璐﹀彿</param>
+        /// <param name="noticeDb">鏄惁閫氱煡浜戠</param>
+        public static void ReLoginAgain(string account = "", bool noticeDb = true)
+        {
+#if iOS
+            //閫�鍑哄叏瑙嗛�氱櫥褰�
+            Shared.IOS.HDLFVSDK.Video.Logout();
+#endif
+            if (Config.Instance.Home.IsVirtually == true)
+            {
+                //濡傛灉鏄櫄鎷熶綇瀹�
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //璁惧畾涓�涓椂闂�
+                    Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
+                    Config.Instance.Save();
+                    //娓呯┖褰撳墠浣忓畢id
+                    Config.Instance.HomeId = string.Empty;
+                    //鏀惰捣宸﹁彍鍗�
+                    CommonPage.Instance.CloseLeftMenu();
+                    //鍏抽棴鍏ㄩ儴寮圭獥
+                    ShowMsgControl.CloseAllMsgDialog();
+                    //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
+                    CloseAllOpenForm(null, false);
+
+                    //鏄剧ず鐧婚檰鐢婚潰
+                    var formLogin = new Login.AccountLoginForm();
+                    Shared.Common.CommonPage.Instance.AddChidren(formLogin);
+                    formLogin.ShowForm(account);
+                });
+                return;
+            }
+            UserCenterResourse.AccountOption.OldAccountId = string.Empty;
+            //鍏抽棴鎵�鏈夋帴鏀�
+            HdlGatewayReceiveLogic.Current.RemoveAllEvent();
+            //娓呴櫎鍗囩骇鍒楄〃
+            FirmwareUpdateResourse.dicUpdateList.Clear();
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //妫�娴婣PP鏄惁鑳藉閫�鍑�
+                while (UserCenterResourse.AccountOption.AppCanSignout == false)
+                {
+                    System.Threading.Thread.Sleep(500);
+                }
+                //璁惧畾涓�涓椂闂�
+                Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
+                Config.Instance.Save();
+
+                //娓呯┖褰撳墠浣忓畢id
+                Config.Instance.HomeId = string.Empty;
+                HdlGatewayLogic.Current.ClearAllRealGatewayConection(false);
+
+                //鏂紑杩滅▼Mqtt杩炴帴
+                HdlThreadLogic.Current.RunThread(async () =>
+                {
+                    await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
+                }, ShowErrorMode.NO);
+
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鏀惰捣宸﹁彍鍗�
+                    CommonPage.Instance.CloseLeftMenu();
+                    //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
+                    CloseAllOpenForm(null, false);
+
+                    //鏄剧ず鐧婚檰鐢婚潰
+                    var formLogin = new Login.AccountLoginForm();
+                    Shared.Common.CommonPage.Instance.AddChidren(formLogin);
+                    formLogin.ShowForm(account);
+                });
+
+                if (noticeDb == true)
+                {
+                    //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
+                    var result = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
+                }
+            });
+        }
+
+        /// <summary>
+        /// 鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
+        /// </summary>
+        /// <param name="tagetFrom">鐩爣鐣岄潰,濡傛灉鎸囧畾浜嗙殑璇�,鍒欏叧闂洰鏍囩晫闈笂灞傜殑鍏ㄩ儴鐣岄潰(瀹冭嚜韬笉鍏抽棴)</param>
+        /// <param name="refreshMainPage">褰撳叧闂殑鐣岄潰杈惧埌涓婚〉鏃�,鏄惁鍒锋柊涓婚〉</param>
+        public static void CloseAllOpenForm(string tagetFrom = null, bool refreshMainPage = true)
+        {
+            while (UserView.HomePage.Instance.ChildrenCount > 0)
+            {
+                var view = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
+                //(鍥犲簳灞傛帶浠朵慨鏀逛簡, 鐖舵帶浠剁Щ闄ゆ椂, 涓嶈Е鍙戝瓙鎺т欢鐨勭Щ闄や簨浠�)
+                if (view is ViewGroup)
+                {
+                    //鍏抽棴鍔犺浇鍦╒iewGroup閲岄潰鐨勮嚜瀹氫箟鐣岄潰Form
+                    CloseViewGroupChildren((ViewGroup)view);
+                }
+
+                if (view is CommonFormBase)
+                {
+                    if (((CommonFormBase)view).FormID == tagetFrom)
+                    {
+                        //鍙叧闂埌鎸囧畾鐩爣鐣岄潰
+                        return;
+                    }
+                    ((CommonFormBase)view).CloseForm();
+                }
+                else if (view is UserView.UserPage)
+                {
+                    //鍒锋柊涓婚〉
+                    if (refreshMainPage == true)
+                    {
+                        UserView.UserPage.Instance.ReFreshControl();
+                    }
+                    return;
+                }
+                else
+                {
+                    view.RemoveFromParent();
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鍏抽棴鍔犺浇鍦╒iewGroup閲岄潰鐨勮嚜瀹氫箟鐣岄潰Form(鍥犲簳灞傛帶浠朵慨鏀逛簡,鐖舵帶浠剁Щ闄ゆ椂,涓嶈Е鍙戝瓙鎺т欢鐨勭Щ闄や簨浠�)
+        /// </summary>
+        /// <param name="group"></param>
+        private static void CloseViewGroupChildren(ViewGroup group)
+        {
+            for (int i = 0; i < group.ChildrenCount; i++)
+            {
+                var view = group.GetChildren(i);
+                if (view is CommonFormBase)
+                {
+                    ((CommonFormBase)view).CloseForm();
+                    i--;
+                }
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鎷兼帴淇℃伅___________________________
+
+        /// <summary>
+        /// 鎷兼帴缃戝叧鍥炲瓒呮椂鐨勪俊鎭�
+        /// </summary>
+        /// <param name="errorMsg">閿欒淇℃伅</param>
+        /// <param name="resultData">缃戝叧杩斿洖鐨剅esultData,閲岄潰鏈夈�恊rrorMessageBase銆戣繖涓笢瑗跨殑閭g瀵硅薄</param>
+        /// <param name="strResultData">缃戝叧杩斿洖鐨剅esultData,閲岄潰鐨勩�恊rrorMessageBase銆戠殑鍊�,璁惧畾鏈夋鍊兼椂锛宺esultData鏃犳晥</param>
+        /// <param name="addBrackets">鏄惁娣诲姞鎷彿</param>
+        /// <returns></returns>
+        public static string CombineGatewayTimeOutMsg(string errorMsg, object resultData, string strResultData = null, bool addBrackets = true)
+        {
+            if (resultData == null && strResultData == null)
+            {
+                return errorMsg;
+            }
+
+            string errorMsgBase = strResultData;
+            if (errorMsgBase == null)
+            {
+                if (resultData is ReceiptGatewayResult)
+                {
+                    errorMsgBase = string.Empty;
+                    if (((ReceiptGatewayResult)resultData).ErrorMsgDiv == 0)
+                    {
+                        errorMsgBase = "鍥炲瓒呮椂";
+                    }
+                }
+                else
+                {
+                    Type myType = resultData.GetType();
+                    object errorObj = myType.InvokeMember("errorMessageBase", System.Reflection.BindingFlags.GetField, null, resultData, null);
+                    if (errorObj == null)
+                    {
+                        return errorMsg;
+                    }
+                    errorMsgBase = errorObj.ToString();
+                }
+            }
+
+            if (errorMsgBase.Contains("鍥炲瓒呮椂") == false)
+            {
+                //鍙湁鍥炲瓒呮椂鐨勬椂鍊欐墠浼氬姞涓�
+                return errorMsg;
+            }
+            errorMsg += "\r\n";
+            if (addBrackets == true)
+            {
+                //(缃戝叧鍥炲瓒呮椂,璇风◢鍚庡啀璇�)
+                return errorMsg + "(" + Language.StringByID(R.MyInternationalizationString.uGatewayResponseTimeOut) + ")";
+            }
+            else
+            {
+                //缃戝叧鍥炲瓒呮椂,璇风◢鍚庡啀璇�
+                return errorMsg + Language.StringByID(R.MyInternationalizationString.uGatewayResponseTimeOut);
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼___________
+
+        /// <summary>
+        /// 寮傛鏂规硶鎵ц(浠呴檺鍒囨崲浣忓畢鏃惰皟鐢�)锛屽埛鏂颁釜浜轰腑蹇冪殑鍐呭瓨鍙婄嚎绋�
+        /// </summary>
+        /// <param name="ShowPrompted">鏂拌拷鍔犲彉閲忥細鏄惁鏄剧ず鎻愮ず鑷姩澶囦唤鐨勭晫闈�</param>
+        /// <returns></returns>
+        public static bool InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
+        {
+            //璋冪敤杩欎釜鏂规硶,閮介渶瑕侀噸鏂板埛鏂颁富椤�
+            UserView.UserPage.Instance.RefreshAllForm = true;
+
+            //娣诲姞缃戠粶鐘舵�佺洃鍚�
+            HdlWifiLogic.Current.StartListenNetWork();
+
+            //濡傛灉鏄櫄鎷熶綇瀹�
+            if (Config.Instance.Home.IsVirtually == true)
+            {
+                //鍒濆鍖栬櫄鎷熶綇瀹呯殑涓汉涓績鐨勬暟鎹�(鍒囨崲浣忓畢浣跨敤)
+                InitUserCenterMenmoryByVirtualHome();
+                return true;
+            }
+
+            //APP缂撳瓨鍔犺浇寮�濮�
+            UserCenterResourse.AccountOption.AppCanSignout = false;
+            //杩樺師杩滅▼杩炴帴鏉冮檺鍙橀噺
+            ZigBee.Device.ZbGateway.AllowRemoteCtrl = true;
+
+            //鍙湁鍦ㄤ綇瀹匢D涓嶄竴鏍风殑鏃跺�欐墠鍋氳繖涓搷浣�
+            if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId
+                || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId)
+            {
+                //鍊熺敤涓�涓嬭繖涓彉閲�(妫�娴嬭兘鍚﹀箍鎾埌缃戝叧)
+                UserCenterResourse.DicReceiveGatewayTest = new Dictionary<string, ZigBee.Device.ZbGateway>();
+                UserCenterResourse.HideOption.CheckCanReceiveGateway = 1;
+
+                //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
+                ClearAllMemberMemory();
+
+                //鍔犺浇璐﹀彿閰嶇疆淇℃伅
+                var optionInfo = UserCenterResourse.AccountOption.Load();
+                UserCenterResourse.AccountOption = optionInfo;
+                //鍙樻洿鏍圭敤鎴峰浘鐗囩洰褰曡矾寰�
+                UserCenterResourse.AccountOption.UserPictruePath = DirNameResourse.UserPictrueDirectory;
+
+                //鍔犺浇浣忓畢閰嶇疆淇℃伅
+                UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
+
+                //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
+                HdlFileLogic.Current.CreatAllUserCenterDirectory();
+
+                //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
+                var hadNet = InitUserAccoutInfo(true);
+                //濡傛灉鏈夌綉缁滅殑璇�
+                if (hadNet == 1)
+                {
+                    //璇诲彇闅愬尶閰嶇疆
+                    //HdlBackupLogic.Current.LoadHideOption();
+                    //璋冭瘯锛氬己鍒跺紑鍚悗鍙拌皟璇旳pp鍔熻兘
+                    if (UserCenterResourse.HideOption.StartDebugApp == 1)
+                    {
+                        HdlThreadLogic.Current.RunMain(() =>
+                        {
+                            var form = new HideOption.HideOptionMainForm();
+                            form.AddForm();
+                        });
+                        ProgressBar.Close(true);
+                        return false;
+                    }
+                }
+
+                //鍏抽棴鎵�鏈夋帴鏀�
+                HdlGatewayReceiveLogic.Current.RemoveAllEvent();
+                //鍒锋柊瀹夐槻涓婃姤淇℃伅
+                HdlAlarmsLogic.Current.RefreshAlarmInfo();
+
+                //淇濆瓨鐢ㄦ埛鐨勭櫥闄嗕俊鎭埌鏈湴
+                SaveUserInformationToLocation();
+
+                UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.HomeId;
+                UserCenterResourse.AccountOption.OldAccountId = Common.Config.Instance.Account;
+
+                //鍚屾鏁版嵁(浜屾璋冪敤娌″叧绯�)
+                int result = -1;
+                if (hadNet == 1)
+                {
+                    result = HdlAutoBackupLogic.SynchronizeDbAutoBackupData();
+                }
+
+                //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅
+                HdlGatewayLogic.Current.ReFreshByLocal();
+                //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅
+                LocalDevice.Current.ReFreshByLocal();
+
+                //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
+                HdlRoomLogic.Current.RefreshAllRoomByLocation();
+
+                if (hadNet == 1)
+                {
+                    //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧
+                    HdlGatewayLogic.Current.ResetComandToBindBackupGateway();
+
+                    //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
+                    HdlGatewayLogic.Current.SynchronizeDbGateway();
+
+                    //璇诲彇App鏈�浣庣増鏈�
+                    HdlFirmwareUpdateLogic.ReadAppLestVersion();
+                    //璇诲彇缃戝叧鏈�浣庣増鏈�
+                    HdlFirmwareUpdateLogic.ReadGatewayLestVersion();
+                }
+
+                //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴
+                HdlThreadLogic.Current.RunThread(async () =>
+                {
+                    HdlGatewayLogic.Current.ClearAllRealGatewayConection(true);
+                    await ZigBee.Device.ZbGateway.CloseRemoteConnectionOnForce();
+                }, ShowErrorMode.NO);
+
+                //鍒锋柊APP鍓嶄竴娆¢�夋嫨鐨勭綉鍏矷D(鍙互鍙嶅璋冪敤,闇�瑕佸湪缃戝叧鍒濆鍖栧畬浜嗕箣鍚庢墠鑳借皟鐢�)
+                HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
+
+                //鍔犺浇妯℃澘缂撳瓨
+                //TemplateData.TemplateCommonLogic.Current.LoadLocalTemplateMemoryData();
+
+                //0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�,杩欎釜鏃跺�欓渶瑕佹彁绀哄浠�
+                if (result == 0 && ShowPrompted == true)
+                {
+                    //寮�鍚嚜鍔ㄥ浠�
+                    HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
+                }
+                //鏄剧ず寮曞鐣岄潰
+                ShowGuideForm(result);
+
+                //鍏抽棴debug骞挎挱
+                UserCenterResourse.HideOption.CheckCanReceiveGateway = 0;
+                System.Threading.Thread.Sleep(30);
+                if (hadNet == 1)
+                {
+                    //浣忓畢鍒囨崲鏃�,妫�娴嬬綉鍏宠繛鎺ユ儏鍐�
+                    CheckGatewayConnection();
+                }
+                UserCenterResourse.DicReceiveGatewayTest = null;
+            }
+            //APP缂撳瓨鍔犺浇瀹屾垚
+            UserCenterResourse.AccountOption.AppCanSignout = true;
+            if (Shared.Phone.Device.Logic.Send.If_Exist == "1")
+            {
+                //浠ユ湰鍦扮姸鎬佷负涓绘墦寮�GPS鏈嶅姟
+                Application.StartGPSLocationService();
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栬櫄鎷熶綇瀹呯殑涓汉涓績鐨勬暟鎹�(鍒囨崲浣忓畢浣跨敤)
+        /// </summary>
+        private static void InitUserCenterMenmoryByVirtualHome()
+        {
+            UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.Home.Id;
+            //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
+            ClearAllMemberMemory();
+            //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
+            HdlFileLogic.Current.CreatAllUserCenterDirectory();
+            //鍏抽棴鎵�鏈夋帴鏀�
+            HdlGatewayReceiveLogic.Current.RemoveAllEvent();
+            //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅
+            HdlGatewayLogic.Current.ReFreshByLocal();
+            //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅
+            Common.LocalDevice.Current.ReFreshByLocal();
+            //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
+            HdlRoomLogic.Current.RefreshAllRoomByLocation();
+            //鍒锋柊宸﹁竟鍒锋柊鎴块棿瑙嗗浘鍒楄〃
+            HdlRoomLogic.Current.RefreshRoomListView();
+            //鍔犺浇妯℃澘缂撳瓨
+            //TemplateData.TemplateCommonLogic.Current.LoadLocalTemplateMemoryData();
+        }
+
+        /// <summary>
+        /// 娓呯┖鎵�鏈夋垚鍛樼紦瀛�
+        /// </summary>
+        private static void ClearAllMemberMemory()
+        {
+            //娑堟伅璁板綍閲嶆柊璇诲彇鍙婃娴�
+            ControlCommonResourse.ReadMessageAgain = true;
+            ControlCommonResourse.HadNewMessage = false;
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                for (int i = 0; i < ControlCommonResourse.listMessageManaContr.Count; i++)
+                {
+                    //鏄剧ず瑙掓爣鐗规晥
+                    ControlCommonResourse.listMessageManaContr[i].IsSelected = false;
+                }
+            });
+
+            //鍒囨崲浣忓畢娓呴櫎涔嬪墠閫昏緫缂撳瓨鏁版嵁;
+            Common.Logic.LogicList.Clear();
+            Common.Logic.LockLogicList.Clear();
+            Common.Logic.SoneLogicList.Clear();
+        }
+
+        /// <summary>
+        /// 浣忓畢鍒囨崲鏃�,妫�娴嬬綉鍏宠繛鎺ユ儏鍐�
+        /// </summary>
+        private static void CheckGatewayConnection()
+        {
+            try
+            {
+                bool canReceiveGw = false;
+                foreach (var gateway in UserCenterResourse.DicReceiveGatewayTest.Values)
+                {
+                    if (gateway.HomeId == Config.Instance.Home.Id)
+                    {
+                        //鑳藉鎼滅储寰楀埌缃戝叧
+                        canReceiveGw = true;
+                        break;
+                    }
+                }
+                UserCenterResourse.DicReceiveGatewayTest = null;
+                //璁剧疆杩滅▼杩炴帴鐨勫垵濮嬪��
+                ZigBee.Device.ZbGateway.IsRemote = canReceiveGw == false;
+                if (canReceiveGw == false)
+                {
+                    //濡傛灉鏄繙绋嬬殑璇�,杩藉姞绛夊緟鏃堕棿
+                    System.Threading.Thread.Sleep(1500);
+                }
+            }
+            catch { }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅_______________
+
+        /// <summary>
+        /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒
+        /// </summary>
+        /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param>
+        /// <returns></returns>
+        private static int InitUserAccoutInfo(bool reLoad)
+        {
+            //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
+            UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
+            if (reLoad == true)
+            {
+                //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
+                UserCenterResourse.UserInfo = GetUserInformationFromLocation();
+                UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            }
+            if (HdlWifiLogic.Current.CanAccessHttp == false)
+            {
+                //鏃犳硶杩炴帴澶栫綉
+                return -1;
+            }
+
+            //鑾峰彇鐧诲綍璐﹀彿鐨勪俊鎭�
+            var pra = new AccountInfoPra();
+            //搴忓垪鍖栧璞�
+            var requestJson = JsonConvert.SerializeObject(pra);
+            //璁块棶鎺ュ彛
+            byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/GetAccountInfo", Encoding.UTF8.GetBytes(requestJson), "POST", 4);
+            if (byteData == null)
+            {
+                return -1;
+            }
+            //妫�娴嬮敊璇�
+            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            if (revertObj.StateCode.ToUpper() != "SUCCESS")
+            {
+                return 2;
+            }
+
+            var userInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(revertObj.ResponseData.ToString());
+            userInfo.Account = Common.Config.Instance.Account;
+            if (string.IsNullOrEmpty(userInfo.UserName) == true)
+            {
+                //娌℃湁鏄电О鐨勬椂鍊欙紝鎶婅处鍙蜂綔涓烘樀绉�
+                userInfo.UserName = Common.Config.Instance.Account;
+            }
+
+            if (Common.Config.Instance.Home.IsOthreShare == false)
+            {
+                //韬唤:绠$悊鍛�
+                userInfo.AuthorityNo = 1;
+                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.Administrator);
+            }
+            else if (Common.Config.Instance.Home.AccountType == 1)
+            {
+                //韬唤:鎴愬憳(鎷ユ湁绠$悊鍛樻潈闄�)
+                userInfo.AuthorityNo = 2;
+                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.uMemberHadActionAuthority);
+            }
+            else
+            {
+                //韬唤:鎴愬憳
+                userInfo.AuthorityNo = 3;
+                userInfo.AuthorityText = Language.StringByID(R.MyInternationalizationString.uMember);
+            }
+
+            //UserInfo.AuthorityNo==0浠h〃鏈湴杩樻病鏈夌敓鎴愭枃浠�,杩欎釜鏃跺�欎笉闇�瑕佸鐞�
+            if (UserCenterResourse.UserInfo.AuthorityNo != userInfo.AuthorityNo
+                && UserCenterResourse.UserInfo.AuthorityNo != 0)
+            {
+                //濡傛灉鐧婚檰鐨勮处鍙风殑鏉冮檺鍜屼笂涓�娆$殑涓嶄竴鏍�,鍒欏垹闄ゆ湰鍦拌繖涓綇瀹呭叏閮ㄧ殑鏂囦欢,浠庡ご鍐嶆潵
+                string dirPath = Config.Instance.FullPath;
+                if (System.IO.Directory.Exists(dirPath) == true)
+                {
+                    try
+                    {
+                        //鍚屾鏁版嵁鐨勫垽鏂枃浠�(浠ラ槻涓囦竴鍒犻櫎鏁翠釜鏂囦欢澶瑰け璐ョ殑鏃跺��,杩欎釜鏂囦欢琚垹鐨勮瘽,搴旇娌′粈涔堝ぇ闂)
+                        string SynchronizeFile = DirNameResourse.AutoDownLoadBackupCheckFile;
+                        //濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘�
+                        HdlFileLogic.Current.DeleteFile(SynchronizeFile);
+                        HdlFileLogic.Current.DeleteDirectory(dirPath);
+                    }
+                    catch { }
+                    //鍒涘缓浣忓畢鏂囦欢澶�
+                    Global.CreateHomeDirectory(Config.Instance.HomeId);
+                    //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
+                    HdlFileLogic.Current.CreatAllUserCenterDirectory();
+                }
+            }
+            if (string.IsNullOrEmpty(userInfo.UserName) == true)
+            {
+                //娌℃湁鏄电О鐨勮瘽,鎶婅处鍙蜂涪杩囧幓
+                userInfo.UserName = userInfo.Account;
+            }
+
+            UserCenterResourse.UserInfo = userInfo;
+            UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            if (UserCenterResourse.UserInfo.HeadImage != null)
+            {
+                //鍐欏叆澶村儚鍐呭
+                HdlFileLogic.Current.SaveByteToFile(UserCenterResourse.UserInfo.UserIconFile, UserCenterResourse.UserInfo.HeadImage);
+            }
+            UserCenterResourse.UserInfo.HeadImage = null;
+            //鎵嬪娍瀵嗙爜
+            UserCenterResourse.AccountOption.GestureAuthentication = UserCenterResourse.UserInfo.GesturePwd == null ? string.Empty : UserCenterResourse.UserInfo.GesturePwd;
+            UserCenterResourse.UserInfo.GesturePwd = null;
+            //瀵嗙爜楠岃瘉
+            UserCenterResourse.AccountOption.PswAuthentication = UserCenterResourse.UserInfo.StringPwd == null ? string.Empty : UserCenterResourse.UserInfo.StringPwd;
+            UserCenterResourse.UserInfo.StringPwd = null;
+            //淇濆瓨缂撳瓨
+            UserCenterResourse.AccountOption.Save();
+
+            //鍒濆鍖栫鐞嗗憳鎺у埗涓讳汉鐨勮繛鎺ュ湴鍧�(鍥犱负杩欎釜杩炴帴Token鏄笉浼氭敼鍙樼殑,鎵�浠ュ彧闇�瑕佸垵濮嬪寲涓�娆�)
+            var flage = InitAdminConnectMainInfo();
+            //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
+            UserCenterResourse.UserInfo.InitUserInfoSuccess = flage == 1;
+
+            return flage;
+        }
+
+        /// <summary>
+        /// 浠庢湰鍦拌幏鍙栫敤鎴风殑鐧婚檰淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        private static UserInformation GetUserInformationFromLocation()
+        {
+            var value = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.UserInfoFile);
+            if (value == null)
+            {
+                return new UserInformation();
+            }
+            var info = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInformation>(value);
+            return info;
+        }
+
+        /// <summary>
+        /// 閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅(鏃ㄥ湪瀵瑰簲閭d竴鐬棿,缃戠粶涓嶅ソ,瀵艰嚧璇垽鐨勬儏鍐�)
+        /// </summary>
+        /// <returns></returns>
+        public static bool ReInitUserAccoutInfo()
+        {
+            //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭�
+            var result = InitUserAccoutInfo(false);
+            if (result == 1)
+            {
+                //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄�
+                HdlGatewayLogic.Current.SynchronizeDbGateway();
+                //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
+                UserCenterResourse.UserInfo.InitUserInfoSuccess = true;
+
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 淇濆瓨鐢ㄦ埛鐨勭櫥闄嗕俊鎭埌鏈湴
+        /// </summary>
+        private static void SaveUserInformationToLocation()
+        {
+            //鍐欏叆鍐呭
+            HdlFileLogic.Current.SaveFileContent(DirNameResourse.UserInfoFile, UserCenterResourse.UserInfo);
+
+            //鎼炰竴涓嬩富浜虹殑榛樿澶村儚
+            string defultFile = IO.FileUtils.GetImageFilePath("Center/Admin.png");
+            if (defultFile == string.Empty)
+            {
+                return;
+            }
+            if (System.IO.File.Exists(UserCenterResourse.UserInfo.UserIconFile) == true)
+            {
+                return;
+            }
+            //澶嶅埗杩囧幓
+            System.IO.File.Copy(defultFile, UserCenterResourse.UserInfo.UserIconFile);
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴___________
+
+        /// <summary>
+        /// 鍒濆鍖栫鐞嗗憳鏉冮檺杩滅▼杩炴帴涓讳汉鐨勪俊鎭� -1:鏃犵綉 1:姝e父 2:鍏朵粬閿欒
+        /// </summary>
+        /// <returns></returns>
+        private static int InitAdminConnectMainInfo()
+        {
+            if (UserCenterResourse.UserInfo.AuthorityNo != 2 && UserCenterResourse.UserInfo.AuthorityNo != 3)
+            {
+                //鏃朵唬鍙樹簡,杩欓噷绠$悊鍛樺拰鎴愬憳閮借兘璋冪敤
+                return 1;
+            }
+            var pra = new
+            {
+                CommonPage.RequestVersion,
+                LoginAccessToken = Config.Instance.Token,
+                MainAccountId = Config.Instance.Home.MainUserDistributedMark,
+                SharedHid = Config.Instance.Home.Id
+            };
+
+            //搴忓垪鍖栧璞�
+            var requestJson = JsonConvert.SerializeObject(pra);
+            //璁块棶鎺ュ彛
+            byte[] byteData = CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("App/GetSharedHomeApiControl", Encoding.UTF8.GetBytes(requestJson));
+            if (byteData == null)
+            {
+                return -1;
+            }
+            //妫�娴嬮敊璇�
+            var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            if (revertObj.StateCode.ToUpper() != "SUCCESS")
+            {
+                return 2;
+            }
+
+            //鍒嗕韩閾炬帴
+            var info = JsonConvert.DeserializeObject<MemberAdministratorResult>(revertObj.ResponseData.ToString());
+            Config.Instance.AdminRequestBaseUrl = info.RequestBaseUrl;
+            Config.Instance.AdminRequestToken = info.RequestToken;
+
+            return 1;
+        }
+
+        #endregion
+
+        #region 鈻� 鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken____________
+
+        /// <summary>
+        /// 鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
+        /// </summary>
+        /// <returns></returns>
+        public static string GetConnectMainToken()
+        {
+            //鍚敤绠$悊鍛樻潈闄�
+            if (Config.Instance.Home.IsOthreShare == true)
+            {
+                return Config.Instance.AdminRequestToken;
+            }
+            return Config.Instance.Token;
+        }
+
+        #endregion
+
+        #region 鈻� 寮曞鐣岄潰___________________________
+
+        /// <summary>
+        /// 鏄剧ず寮曞鐣岄潰
+        /// </summary>
+        /// <param name="result">鍚屾缁撴灉 -1锛氬紓甯�   0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�  1锛氭甯稿悓姝�  2:娌℃湁鑷姩澶囦唤鏁版嵁</param>
+        private static void ShowGuideForm(int result)
+        {
+            var checkFile = DirNameResourse.GuideFile;
+            if (System.IO.File.Exists(checkFile) == true)
+            {
+                //涓嶉渶瑕佹樉绀�
+                return;
+            }
+            if (result == 2 && Config.Instance.Home.IsOthreShare == false)
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    var form = new Guide.GuideHouseForm();
+                    form.ShowFrom();
+                });
+            }
+
+            //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚寮曞)
+            var file = System.IO.File.Create(checkFile);
+            file.Close();
+        }
+
+        #endregion
+
+        #region 鈻� 16杩涘埗杞寲_________________________
+
+        /// <summary>
+        /// 灏�16杩涘埗鐨勬枃鏈炕璇戜负姝e父鏂囨湰
+        /// </summary>
+        /// <param name="hexText">16杩涘埗鐨勬枃鏈�</param>
+        /// <param name="count">浠ュ灏戜釜瀛楄妭涓轰竴缁�</param>
+        /// <returns></returns>
+        public static string TranslateHexadecimalIntoText(string hexText, int count = 2)
+        {
+            string textValue = string.Empty;
+            while (hexText.Length > 0)
+            {
+                string temp = hexText.Substring(0, count);
+                hexText = hexText.Substring(count);
+                int value = Convert.ToInt32(temp, 16);
+                textValue += ((char)value).ToString();
+            }
+            return textValue;
+        }
+
+        /// <summary>
+        /// 灏嗘枃鏈炕璇戜负16杩涘埗鐨勬枃鏈�
+        /// </summary>
+        /// <param name="text">鎸囧畾鏂囨湰</param>
+        /// <returns></returns>
+        public static string TranslateTextIntoHexadecimal(string text)
+        {
+            string textValue = string.Empty;
+            foreach (char c in text)
+            {
+                int value = Convert.ToInt32(c);
+                textValue += Convert.ToString(value, 16);
+            }
+            return textValue;
+        }
+
+        #endregion
+
+        #region 鈻� 鍔犲瘑鍜岃В瀵哶________________________
+
+        /// <summary>
+        /// 鍔犲瘑瀵嗙爜
+        /// </summary>
+        /// <param name="keys"></param>
+        /// <param name="strPsw"></param>
+        /// <returns></returns>
+        public static string EncryptPassword(string keys, string strPsw)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(strPsw) == true)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+                byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+                StringBuilder ret = new StringBuilder();
+                foreach (byte b in ms.ToArray())
+                {
+                    ret.AppendFormat("{0:X2}", b);
+                }
+                return ret.ToString().ToLower();
+            }
+            catch { return strPsw; }
+        }
+
+        /// <summary>
+        /// 瑙e瘑瀵嗙爜
+        /// </summary>
+        /// <param name="strPsw"></param>
+        /// <returns></returns>
+        public static string DecryptPassword(string keys, string strPsw)
+        {
+            try
+            {
+                if (strPsw == string.Empty)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+
+                byte[] inputByteArray = new byte[strPsw.Length / 2];
+                for (int x = 0; x < strPsw.Length / 2; x++)
+                {
+                    int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
+                    inputByteArray[x] = (byte)i;
+                }
+
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+
+                StringBuilder ret = new StringBuilder();
+
+                return System.Text.Encoding.Default.GetString(ms.ToArray());
+            }
+            catch { return strPsw; }
+        }
+        #endregion
+
+        #region 鈻� 鏃堕棿杞崲___________________________
+
+        /// <summary>
+        /// 灏唘tc鏃堕棿绫诲瀷鐨勫瓧绗︿覆,杞崲涓烘湰鍦版椂闂�
+        /// </summary>
+        /// <param name="timeText"></param>
+        /// <returns></returns>
+        public static DateTime ConvertUtcTimeToLocalTime(string timeText)
+        {
+            var utcTime = Convert.ToDateTime(timeText);
+            return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0