From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs | 4678 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 2,406 insertions(+), 2,272 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
old mode 100755
new mode 100644
index 23e7d57..03bcd7a
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs
@@ -1,2272 +1,2406 @@
-锘縰sing Newtonsoft.Json;
-using Shared.Common;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using ZigBee.Device;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// <para>瀹夐槻鏈湴缂撳瓨(浠g爜浣跨敤)</para>
-    /// <para>闃插尯ID(ZoneId)锛�</para>
-    /// <para>1锛�24灏忔椂闃插尯  2锛�24灏忔椂闈欓煶闃插尯  3锛氬嚭鍏ラ槻鍖�  4锛氬唴閮ㄩ槻鍖�  5锛氬懆鐣岄槻鍖�</para>
-    /// <para>闃插尯妯″紡ID(ActionType -> 闃插尯ID鎹㈢畻:ZoneId=3,4,5閮藉綋鍋�3澶勭悊)锛�</para>
-    /// <para>1锛�24灏忔椂闃插尯  2锛氶潤闊抽槻鍖�  3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級</para>
-    /// <para>甯冮槻妯″紡ID(GarrisonMode)锛�</para>
-    /// <para>1锛氬湪瀹跺竷闃� 鎴栬�� 甯冮槻(鍐呴儴闃插尯娌℃湁璁剧疆鐨勬椂鍊�)  2锛氱瀹跺竷闃�</para>
-    /// </summary>
-    public class HdlSafeguardLogic
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 鏈湴瀹夐槻鏁版嵁
-        /// </summary>
-        private static HdlSafeguardLogic m_Current = null;
-        /// <summary>
-        /// 鏈湴瀹夐槻鏁版嵁
-        /// </summary>
-        public static HdlSafeguardLogic Current
-        {
-            get
-            {
-                if (m_Current == null)
-                {
-                    m_Current = new HdlSafeguardLogic();
-                }
-                return m_Current;
-            }
-            set
-            {
-                m_Current = value;
-            }
-        }
-
-        /// <summary>
-        /// 褰撳墠鐨勫竷闃叉ā寮�(娉ㄦ剰,杩欎釜涓滆タ鍙粰瀹夐槻涓荤晫闈㈠垵濮嬪寲鐨勬椂鍊欎娇鐢紒锛�)
-        /// </summary>
-        public GarrisonMode NowGarrisonMode = GarrisonMode.None;
-        /// <summary>
-        /// 鐢ㄦ埛瀵嗙爜鐨勭紦瀛�
-        /// </summary>
-        private string UserPassword = null;
-        /// <summary>
-        /// 瀹夐槻鏁版嵁缂撳瓨
-        /// </summary>
-        private Dictionary<int, SafeguardZoneInfo> dicAllZoneInfo = new Dictionary<int, SafeguardZoneInfo>();
-
-        #endregion
-
-        #region 鈻� 鍒锋柊瀹夐槻___________________________
-
-        /// <summary>
-        /// 浠庢柊浠庣綉鍏抽偅閲岃幏鍙栨暟鎹�(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
-        /// </summary>
-        /// <returns></returns>
-        public async Task<bool> ReFreshByGateway()
-        {
-            //鍏堟竻绌�
-            this.dicAllZoneInfo.Clear();
-            var mainGateway = ZbGateway.MainGateWay;
-            if (mainGateway == null)
-            {
-                //閿欒:缃戝叧瀵硅薄涓㈠け
-                string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
-                this.ShowTipMsg(msg);
-                return false;
-            }
-            var mainWayId = HdlGatewayLogic.Current.GetGatewayId(mainGateway);
-
-            //涓婚鏁板浐瀹�5+3+1
-            int topicCount = 9;
-            //閿欒
-            bool error = false;
-
-            //闃插尯璁惧淇℃伅
-            var listDevice = new List<Safeguard.GetZoneDeviceListByIdResponData>();
-            //鎶ヨ鐩爣
-            var listAlarm = new List<Safeguard.CatZoneActionResponseData>();
-            //瀹夐槻妯″紡
-            var listMode = new List<Safeguard.GetModeUsingResponseData>();
-
-            Action<string, string> action = (topic, message) =>
-            {
-                var gatewayID = topic.Split('/')[0];
-                if (gatewayID != mainWayId)
-                {
-                    return;
-                }
-
-                //妫�娴嬪叡閫氶敊璇�
-                if (topic == gatewayID + "/" + "Error_Respon")
-                {
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-
-                    var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.Safeguard.ErrorResponData>(jobject["Data"].ToString());
-                    if (temp != null)
-                    {
-                        string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error);
-                        if (msg != null)
-                        {
-                            this.ShowTipMsg(msg);
-                        }
-                    }
-                    error = true;
-                }
-                //闃插尯璁惧淇℃伅
-                if (topic == gatewayID + "/Security/GetZoneDeviceList_Respon")
-                {
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
-                    if (result == 0)
-                    {
-                        var data = JsonConvert.DeserializeObject<Safeguard.GetZoneDeviceListByIdResponData>(jobject["Data"].ToString());
-                        if (data != null)
-                        {
-                            //灏嗛槻鍖轰紶鎰熷櫒璁惧鍒楄〃鍔犲叆缂撳瓨
-                            listDevice.Add(data);
-                            topicCount--;
-                            return;
-                        }
-                    }
-                    error = true;
-                }
-                //闃插尯鎶ヨ鐩爣
-                if (topic == gatewayID + "/Security/GetZoneAction_Respon")
-                {
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
-                    if (result == 0)
-                    {
-                        var data = JsonConvert.DeserializeObject<Safeguard.CatZoneActionResponseData>(jobject["Data"].ToString());
-                        if (data != null)
-                        {
-                            //灏嗛槻鍖烘姤璀︾洰鏍囧姞鍏ョ紦瀛�
-                            listAlarm.Add(data);
-                            topicCount--;
-                            return;
-                        }
-                    }
-                    error = true;
-                }
-                //褰撳墠甯冮槻妯″紡
-                if (topic == gatewayID + "/Security/GetCurrentMode_Respon")
-                {
-                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
-                    if (result != 0)
-                    {
-                        //褰撳墠娌℃湁妯′豢妯″紡
-                        this.NowGarrisonMode = GarrisonMode.None;
-                    }
-                    else
-                    {
-                        var data = JsonConvert.DeserializeObject<Safeguard.GetModeUsingResponseData>(jobject["Data"].ToString());
-                        if (data != null)
-                        {
-                            //璁剧疆褰撳墠妯′豢妯″紡
-                            this.NowGarrisonMode = (GarrisonMode)data.ModeId;
-                        }
-                    }
-                    topicCount--;
-                }
-            };
-            mainGateway.Actions += action;
-            try
-            {
-                var jObject = new Newtonsoft.Json.Linq.JObject() { { "Cluster_ID", 0 }, { "Command", 4036 } };
-                mainGateway.Send("Security/GetSecurityInfo", jObject.ToString());
-            }
-            catch { }
-
-            var dateTime = DateTime.Now;
-            while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
-            {
-                if (topicCount <= 0 || error == true)
-                {
-                    //9娆′富棰樺叏閮ㄦ帴鏀跺畬鎴�
-                    break;
-                }
-                await Task.Delay(50);
-            }
-            mainGateway.Actions -= action;
-
-            if (topicCount > 0)
-            {
-                //鑾峰彇闃插尯淇℃伅澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyInfoFail);
-                this.ShowTipMsg(msg);
-                return false;
-            }
-
-            //灏嗛槻鍖轰紶鎰熷櫒璁惧鍒楄〃鍔犲叆缂撳瓨
-            foreach (var data in listDevice)
-            {
-                this.SetZoneSensorDeviceToMemory(data);
-            }
-            //灏嗛槻鍖烘姤璀︾洰鏍囧姞鍏ョ紦瀛�
-            foreach (var data in listAlarm)
-            {
-                this.SetAlarmTargetDeviceToMemory(data);
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 灏嗛槻鍖鸿澶�(浼犳劅鍣�)鍒楄〃鍔犲叆缂撳瓨
-        /// </summary>
-        /// <param name="allData">闃插尯鏁版嵁</param>
-        private void SetZoneSensorDeviceToMemory(Safeguard.GetZoneDeviceListByIdResponData allData)
-        {
-            if (this.dicAllZoneInfo.ContainsKey(allData.ZoneId) == false)
-            {
-                this.dicAllZoneInfo[allData.ZoneId] = new SafeguardZoneInfo();
-            }
-
-            //璁剧疆鍩烘湰淇℃伅
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[allData.ZoneId];
-            zoneInfo.ZoneId = allData.ZoneId;
-            zoneInfo.ZoneName = allData.ZoneName;
-
-            //澶勭悊璁惧
-            foreach (var data2 in allData.DeviceList)
-            {
-                string mainKey = data2.MacAddr + data2.Epoint;
-                //浼犳劅鍣ㄨ澶囦俊鎭�
-                var Deviceinfo = new Safeguard.ZoneDeviceListData();
-                Deviceinfo.IsBypass = data2.IsBypass;
-                Deviceinfo.MomentStatus = data2.MomentStatus;
-                Deviceinfo.TriggerZoneStatus = data2.TriggerZoneStatus;
-                Deviceinfo.MacAddr = data2.MacAddr;
-                Deviceinfo.Epoint = data2.Epoint;
-                zoneInfo.dicSensor[mainKey] = Deviceinfo;
-
-                //鏈湴鏄惁鏈夎繖涓澶�
-                CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
-                if (device != null)
-                {
-                    //鍏ㄩ儴璁惧
-                    zoneInfo.dicAllDevice[mainKey] = device.FilePath;
-                }
-                else
-                {
-                    //鍏ㄩ儴璁惧(缂哄け鐨勬湭鐭ヨ澶�)
-                    var tempDevice = new CommonDevice();
-                    tempDevice.DeviceAddr = data2.MacAddr;
-                    tempDevice.DeviceEpoint = data2.Epoint;
-                    zoneInfo.dicAllDevice[mainKey] = tempDevice.FilePath;
-                }
-            }
-        }
-
-        /// <summary>
-        /// 灏嗘姤璀︾洰鏍囧垪琛ㄥ姞鍏ョ紦瀛�
-        /// </summary>
-        /// <param name="resData">
-        /// <para>1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔</para>
-        /// <para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔</para>
-        /// <para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔</para>
-        /// </param>
-        /// <param name="mode">鏄惁鏄剧ず閿欒</param>
-        /// <returns></returns>
-        private void SetAlarmTargetDeviceToMemory(Safeguard.CatZoneActionResponseData resData, ShowErrorMode mode = ShowErrorMode.NO)
-        {
-            int ActionType = resData.ActionType;
-            if (this.dicAllZoneInfo.ContainsKey(ActionType) == false)
-            {
-                this.dicAllZoneInfo[ActionType] = new SafeguardZoneInfo();
-                //璁剧疆鍩烘湰淇℃伅
-                this.dicAllZoneInfo[ActionType].ZoneId = ActionType;
-            }
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ActionType];
-
-            zoneInfo.dicAlarmDevice.Clear();
-            zoneInfo.dicScenes.Clear();
-
-            //淇℃伅鎺ㄩ��
-            zoneInfo.InformationPush = resData.IsDisablePushMessage;
-
-            foreach (var data in resData.Actions)
-            {
-                //璁惧
-                if (data.Type == 0)
-                {
-                    //鏈湴鏄惁鏈夎繖涓澶�
-                    string mainKey = data.DeviceAddr + data.Epoint;
-                    //鎶ヨ淇℃伅
-                    zoneInfo.dicAlarmDevice[mainKey] = data;
-                    CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
-                    if (device != null)
-                    {
-                        //鍏ㄩ儴璁惧
-                        zoneInfo.dicAllDevice[mainKey] = device.FilePath;
-                    }
-                    else
-                    {
-                        //鍏ㄩ儴璁惧(缂哄け鐨勬湭鐭ヨ澶�)
-                        var tempDevice = new CommonDevice();
-                        tempDevice.DeviceAddr = data.DeviceAddr;
-                        tempDevice.DeviceEpoint = data.Epoint;
-                        zoneInfo.dicAllDevice[mainKey] = tempDevice.FilePath;
-                    }
-                }
-                //鍦烘櫙
-                else if (data.Type == 1)
-                {
-                    //鍦烘櫙
-                    zoneInfo.dicScenes[data.ScenesId] = data.ESName;
-                }
-            }
-        }
-        #endregion
-
-        #region 鈻� 鑾峰彇璁惧___________________________
-
-        /// <summary>
-        /// 鑾峰彇鎸囧畾闃插尯鐨勬墍鏈変紶鎰熷櫒璁惧鐨勪俊鎭�
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <returns></returns>
-        public List<Safeguard.ZoneDeviceListData> GetSensorDevicesInfoByZoonID(int zoonId)
-        {
-            var list = new List<Safeguard.ZoneDeviceListData>();
-            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
-            {
-                return list;
-            }
-            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
-            foreach (var data in info.dicSensor.Values)
-            {
-                list.Add(data);
-            }
-
-            return list;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鍏ㄩ儴鐨勪紶鎰熷櫒璁惧鐨勪俊鎭�(鎸夐槻鍖哄垎缁�)
-        /// </summary>
-        /// <returns></returns>
-        public Dictionary<int, List<Safeguard.ZoneDeviceListData>> GetAllSensorDeviceInfo()
-        {
-            var dic = new Dictionary<int, List<Safeguard.ZoneDeviceListData>>();
-
-            foreach (int ZoonId in this.dicAllZoneInfo.Keys)
-            {
-                List<Safeguard.ZoneDeviceListData> list = this.GetSensorDevicesInfoByZoonID(ZoonId);
-                if (list.Count > 0)
-                {
-                    dic[ZoonId] = list;
-                }
-            }
-            return dic;
-        }
-
-        /// <summary>
-        /// 鏍规嵁闃插尯ID鑾峰彇鏈湴鎶ヨ鐩爣
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <returns></returns>
-        public List<Safeguard.CatActionResponseObj> GetLocalAlarmTargetInfoByZoneId(int ZoneId)
-        {
-            if (ZoneId > 3)
-            {
-                ZoneId = 3;
-            }
-            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
-            {
-                return new List<Safeguard.CatActionResponseObj>();
-            }
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ZoneId];
-
-            //浼樺厛鍦烘櫙鍚�
-            var list = new List<Safeguard.CatActionResponseObj>();
-            foreach (int sceneId in zoneInfo.dicScenes.Keys)
-            {
-                var objData = new Safeguard.CatActionResponseObj();
-                objData.Type = 1;
-                objData.ScenesId = sceneId;
-                objData.ESName = zoneInfo.dicScenes[sceneId];
-
-                list.Add(objData);
-            }
-            foreach (var data in zoneInfo.dicAlarmDevice.Values)
-            {
-                list.Add(data);
-            }
-            return list;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎸囧畾浼犳劅鍣ㄦ墍澶勭殑闃插尯ID(涓嶅瓨鍦ㄥ垯杩斿洖-1)
-        /// </summary>
-        /// <param name="device">鎸囧畾浼犳劅鍣ㄨ澶�</param>
-        /// <returns></returns>
-        public int GetZoneIdByIASZone(CommonDevice device)
-        {
-            string mainkey = this.GetDeviceMainKeys(device);
-            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
-            {
-                if (info.dicSensor.ContainsKey(mainkey) == true)
-                {
-                    return info.ZoneId;
-                }
-            }
-            return -1;
-        }
-
-        #endregion
-
-        #region 鈻� 娣诲姞浼犳劅鍣╛________________________
-
-        /// <summary>
-        /// 娣诲姞浼犳劅鍣ㄨ澶囧埌闃插尯(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <param name="listdevice">璁惧鍒楄〃</param>
-        public async Task<bool> AddSensorDevice(int zoonId, List<CommonDevice> listdevice)
-        {
-            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode != null)
-            {
-                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶娣诲姞璁惧
-                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotAddDeviceInGarrisonMode);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            //鏍¢獙瀵嗙爜
-            bool result = await this.ShowSafetyAdminValidatedDialog();
-            if (result == false)
-            {
-                return false;
-            }
-
-            if (listdevice.Count == 0)
-            {
-                return true;
-            }
-
-            List<int> listMomentStatus = new List<int>();
-            List<int> listTriggerStatus = new List<int>();
-            foreach (var device in listdevice)
-            {
-                int MomentStatus = 1;
-                int TriggerZoneStatus = 1;
-                //鑾峰彇瀹夐槻浼犳劅鍣ㄧ殑鐬棿鐘舵�佽瀹氬��
-                this.GetSafeguardSensorMomentStatus(device, ref MomentStatus, ref TriggerZoneStatus);
-
-                listMomentStatus.Add(MomentStatus);
-                listTriggerStatus.Add(TriggerZoneStatus);
-            }
-
-            //娣诲姞璁惧鍒扮綉鍏�
-            List<string> listSuccess = await this.AddSensorDeviceToGateway(zoonId, listdevice, listMomentStatus, listTriggerStatus);
-            if (listSuccess == null)
-            {
-                return false;
-            }
-
-            //淇敼缂撳瓨
-            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
-            {
-                this.dicAllZoneInfo[zoonId] = new SafeguardZoneInfo();
-            }
-
-            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
-            for (int i = 0; i < listdevice.Count; i++)
-            {
-                CommonDevice device = listdevice[i];
-                string mainkey = this.GetDeviceMainKeys(device);
-                if (listSuccess.Contains(mainkey) == false)
-                {
-                    //娌℃湁娣诲姞鎴愬姛
-                    continue;
-                }
-
-                Safeguard.ZoneDeviceListData sensorInfo = null;
-                if (info.dicSensor.ContainsKey(mainkey) == true)
-                {
-                    sensorInfo = info.dicSensor[mainkey];
-                }
-                else
-                {
-                    sensorInfo = new Safeguard.ZoneDeviceListData();
-                    info.dicSensor[mainkey] = sensorInfo;
-                    sensorInfo.Epoint = device.DeviceEpoint;
-                    sensorInfo.MacAddr = device.DeviceAddr;
-                    sensorInfo.IsBypass = 0;
-                }
-                info.dicAllDevice[mainkey] = device.FilePath;
-                //璁惧淇℃伅
-                sensorInfo.MomentStatus = listMomentStatus[0];
-                sensorInfo.TriggerZoneStatus = listTriggerStatus[0];
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 娣诲姞浼犳劅鍣ㄨ澶囧埌缃戝叧(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <param name="listdevice">璁惧鍒楄〃</param>
-        /// <param name="listMomentStatus">璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵��</param>
-        /// <param name="listTriggerStatus">鎴戜篃涓嶇煡閬撹繖涓槸浠�涔堜笢瑗�</param>
-        /// <returns></returns>
-        private async Task<List<string>> AddSensorDeviceToGateway(int zoonId, List<CommonDevice> listdevice, List<int> listMomentStatus, List<int> listTriggerStatus)
-        {
-            var addData = new Safeguard.AddDeviceToZoneData();
-            addData.ZoneId = zoonId;
-            addData.LoginToken = this.GetLoginToken();
-
-            for (int i = 0; i < listdevice.Count; i++)
-            {
-                CommonDevice device = listdevice[i];
-                //鏁版嵁缁勮
-                var deviceData = new Safeguard.DeviceListObj();
-                deviceData.Epoint = device.DeviceEpoint;
-                deviceData.MacAddr = device.DeviceAddr;
-                deviceData.MomentStatus = listMomentStatus[i];
-                deviceData.TriggerZoneStatus = listTriggerStatus[i];
-                addData.DeviceList.Add(deviceData);
-            }
-
-            //娌℃湁鏁版嵁
-            if (addData.DeviceList.Count == 0)
-            {
-                return new List<string>();
-            }
-            //娣诲姞鍒扮綉鍏�
-            var returnData = await Safeguard.AddDeviceToZoneAsync(addData);
-            if (returnData == null || returnData.addDeviceToPartResponseData == null || returnData.addDeviceToPartResponseData.Result == 1)
-            {
-                //鍚戦槻鍖烘坊鍔犺澶囧け璐�
-                string msg = Language.StringByID(R.MyInternationalizationString.uAddDeviceToZoneFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
-
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-
-            List<string> listSuccess = new List<string>();
-            foreach (var data in returnData.addDeviceToPartResponseData.DeviceList)
-            {
-                //涓�鎵硅澶囬噷闈紝鎴愬姛娣诲姞鐨�
-                if (data.Status == 0)
-                {
-                    listSuccess.Add(data.MacAddr + data.Epoint);
-                }
-                else if (data.Status == 1)
-                {
-                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
-                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
-                    //鐩爣璁惧涓嶅瓨鍦�
-                    msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
-                    this.ShowTipMsg(msg);
-                }
-                else if (data.Status == 2)
-                {
-                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
-                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
-                    //璁惧宸插姞鍏ュ叾瀹冮槻鍖�
-                    msg += Language.StringByID(R.MyInternationalizationString.uDeviceHadAddToTheOtherGarrison);
-                    this.ShowTipMsg(msg);
-                }
-            }
-
-            return listSuccess;
-        }
-
-        /// <summary>
-        /// 鑾峰彇瀹夐槻浼犳劅鍣ㄧ殑鐬棿鐘舵�佽瀹氬��(娣诲姞浼犳劅鍣ㄥ埌瀹夐槻鏃讹紝闇�瑕佽皟鐢ㄦ鏂规硶鏉ュ垵濮嬪寲鍙傛暟)
-        /// </summary>
-        /// <param name="device">璁惧瀵硅薄</param>
-        /// <param name="MomentStatus">璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵��</param>
-        /// <param name="TriggerZoneStatus">鎴戜篃涓嶇煡閬撹繖涓槸浠�涔堜笢瑗�</param>
-        public void GetSafeguardSensorMomentStatus(CommonDevice device, ref int MomentStatus, ref int TriggerZoneStatus)
-        {
-            //杩愬姩浼犳劅鍣�
-            if (device.IasDeviceType == 13)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //鐑熼浘浼犳劅鍣�
-            else if (device.IasDeviceType == 40)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //姘翠镜浼犳劅鍣�
-            else if (device.IasDeviceType == 42)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //鐕冩皵浼犳劅鍣�
-            else if (device.IasDeviceType == 43)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //绱ф�ユ寜閽�
-            else if (device.IasDeviceType == 44)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //閽ュ寵鎵�
-            else if (device.IasDeviceType == 277)
-            {
-                MomentStatus = 1;
-                TriggerZoneStatus = 1;
-            }
-            //闂ㄧ獥浼犳劅鍣�
-            else if (device.IasDeviceType == 21 || device.IasDeviceType == 22)
-            {
-                MomentStatus = 0;
-                TriggerZoneStatus = 1;
-            }
-            //濡傛灉鏄櫄鎷熻澶囷紝鍒欒繖涓笢瑗挎案鎭掍负0
-            if (device.DriveCode > 0)
-            {
-                MomentStatus = 0;
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鍒犻櫎璁惧___________________________
-
-        /// <summary>
-        /// 鍒犻櫎浼犳劅鍣ㄨ澶�
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <param name="listdevice">浼犳劅鍣ㄨ澶囧璞�</param>
-        public async Task<bool> DeleteSensorDevice(int zoonId, List<CommonDevice> listdevice)
-        {
-            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode != null)
-            {
-                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶鍒犻櫎璁惧
-                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotDeleteDeviceInGarrisonMode);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-
-            //鏍¢獙瀵嗙爜
-            bool result = await this.ShowSafetyAdminValidatedDialog();
-            if (result == false)
-            {
-                return false;
-            }
-
-            if (listdevice.Count == 0)
-            {
-                return true;
-            }
-
-            //浠庣綉鍏抽偅閲屽垹闄よ澶�
-            List<string> listKeys = await this.DeleteSensorDeviceFromGateway(zoonId, listdevice);
-            if (listKeys == null)
-            {
-                return false;
-            }
-
-            //淇敼缂撳瓨
-            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
-            {
-                return true;
-            }
-
-            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
-            foreach (CommonDevice device in listdevice)
-            {
-                string mainkey = this.GetDeviceMainKeys(device);
-                if (info.dicSensor.ContainsKey(mainkey) == true
-                    && listKeys.Contains(mainkey) == true)
-                {
-                    info.dicSensor.Remove(mainkey);
-                    info.dicAllDevice.Remove(mainkey);
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// 浠庣綉鍏抽偅閲屽垹闄や紶鎰熷櫒璁惧
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <param name="listdevice">璁惧瀵硅薄</param>
-        /// <returns></returns>
-        private async Task<List<string>> DeleteSensorDeviceFromGateway(int zoonId, List<CommonDevice> listdevice)
-        {
-            var deteleData = new Safeguard.RemoveEqToZoneData();
-            deteleData.ZoneId = zoonId;
-            deteleData.LoginToken = this.GetLoginToken();
-
-            foreach (CommonDevice device in listdevice)
-            {
-                //缁勮鏁版嵁
-                var removeData = new Safeguard.RemoveDeviceListObj();
-                removeData.MacAddr = device.DeviceAddr;
-                removeData.Epoint = device.DeviceEpoint;
-                deteleData.RemoveDeviceList.Add(removeData);
-            }
-
-            //娌℃湁鏁版嵁
-            if (deteleData.RemoveDeviceList.Count == 0)
-            {
-                return new List<string>();
-            }
-
-            //浠庣綉鍏充腑绉婚櫎
-            var returnData = await Safeguard.RemoveDeviceToZoneAsync(deteleData);
-            if (returnData == null || returnData.removeDeviceToZoneResponseData == null || returnData.removeDeviceToZoneResponseData.Result == 1)
-            {
-                //璁惧鍒犻櫎澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
-
-                this.ShowErrorMsg(msg);
-
-                return null;
-            }
-
-            List<string> listKeys = new List<string>();
-            foreach (var data in returnData.removeDeviceToZoneResponseData.RemoveDeviceList)
-            {
-                if (data.Status == 0)
-                {
-                    listKeys.Add(data.MacAddr + data.Epoint);
-                }
-            }
-
-            return listKeys;
-        }
-
-        #endregion
-
-        #region 鈻� 瀛樺湪妫�娴媉__________________________
-
-        /// <summary>
-        /// 鎸囧畾浼犳劅鍣ㄨ澶囨槸鍚﹀瓨鍦ㄤ簬瀹夐槻缃戝叧
-        /// </summary>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        public bool IsSensorDeviceExist(CommonDevice device)
-        {
-            string mainkey = this.GetDeviceMainKeys(device);
-            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
-            {
-                if (info.dicSensor.ContainsKey(mainkey) == true)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// 鎸囧畾浼犳劅鍣ㄨ澶囨槸鍚﹀瓨鍦ㄤ簬瀹夐槻缃戝叧
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        public bool IsSensorDeviceExist(int ZoneId, CommonDevice device)
-        {
-            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
-            {
-                return false;
-            }
-            string mainkey = this.GetDeviceMainKeys(device);
-            SafeguardZoneInfo info = this.dicAllZoneInfo[ZoneId];
-
-            if (info.dicSensor.ContainsKey(mainkey) == true)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// 鎸囧畾鎶ヨ璁惧鏄惁瀛樺湪浜庡畨闃茬綉鍏�
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        public bool IsAlarmDeviceExist(int ZoneId, CommonDevice device)
-        {
-            if (ZoneId < 3)
-            {
-                if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
-                {
-                    return false;
-                }
-                string mainkey = this.GetDeviceMainKeys(device);
-                SafeguardZoneInfo info = this.dicAllZoneInfo[ZoneId];
-
-                if (info.dicAlarmDevice.ContainsKey(mainkey) == true)
-                {
-                    return true;
-                }
-            }
-            else
-            {
-                string mainkey = this.GetDeviceMainKeys(device);
-
-                for (int i = 3; i <= 5; i++)
-                {
-                    if (this.dicAllZoneInfo.ContainsKey(i) == false)
-                    {
-                        continue;
-                    }
-                    SafeguardZoneInfo info = this.dicAllZoneInfo[i];
-
-                    if (info.dicAlarmDevice.ContainsKey(mainkey) == true)
-                    {
-                        return true;
-                    }
-                }
-            }
-
-            return false;
-        }
-
-        /// <summary>
-        /// 鎸囧畾甯冮槻鏄惁瀛樺湪浜庡畨闃茬綉鍏�
-        /// </summary>
-        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
-        /// <returns></returns>
-        public bool IsZoonExist(int zoonId)
-        {
-            return this.dicAllZoneInfo.ContainsKey(zoonId);
-        }
-
-        /// <summary>
-        /// 鏄惁璁剧疆鏈夊唴閮ㄩ槻鍖�
-        /// </summary>
-        /// <returns></returns>
-        public bool IsHadInternalDefenseArea()
-        {
-            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
-            {
-                //瀛樺湪绗洓闃插尯
-                if (info.ZoneId == 4)
-                {
-                    //閲岄潰鏈夋病鏈夎澶�
-                    if (info.dicSensor.Count > 0)
-                    {
-                        return true;
-                    }
-                    //涓嶅啀寰�涓嬪惊鐜�
-                    return false;
-                }
-            }
-            return false;
-        }
-
-        #endregion
-
-        #region 鈻� 瀹夐槻鐧婚檰___________________________
-
-        /// <summary>
-        /// 涓荤敤鎴风櫥闄�  0:瀵嗙爜閿欒  1:姝e父  -1:寮傚父
-        /// </summary>
-        /// <param name="password"></param>
-        /// <param name="showMode"></param>
-        public async Task<int> AdminLogin(string password, ShowErrorMode showMode = ShowErrorMode.YES)
-        {
-            //灏濊瘯鐧婚檰
-            var resultData = await ZigBee.Device.Safeguard.AdminLoginResponAsync(password, this.GetLoginToken());
-            if (resultData == null)
-            {
-                return -1;
-            }
-            if (resultData != null && resultData.Result != 0)
-            {
-                if (showMode == ShowErrorMode.YES)
-                {
-                    //绠$悊鍛樺瘑鐮侀敊璇�
-                    string msg = Language.StringByID(R.MyInternationalizationString.uAdministratorPasswordIsError);
-                    this.ShowErrorMsg(msg);
-                }
-                return 0;
-            }
-
-            return 1;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎸囧畾鐢ㄦ埛鐨勫瘑鐮�,濡傛灉鐢ㄦ埛涓嶅瓨鍦紝鍒欒繑鍥瀗ull(閿欒涓嶄細寮瑰嚭淇℃伅)
-        /// </summary>
-        /// <param name="userId"></param>
-        /// <returns></returns>
-        public async Task<string> GetUserPassword(int userId)
-        {
-            //鍏堣幏鍙栧瘑鐮�
-            var nowPw = await Safeguard.CatUserPasswordAsync(this.GetLoginToken());
-            if (nowPw == null || nowPw.catUserPasswordResponseData == null)
-            {
-                return null;
-            }
-
-            foreach (var pw in nowPw.catUserPasswordResponseData.UserPasswordList)
-            {
-                if (pw.UserId == userId)
-                {
-                    return pw.Password;
-                }
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鍏ㄩ儴鐢ㄦ埛鐨勫瘑鐮�(閿欒浼氬脊鍑轰俊鎭�)
-        /// </summary>
-        /// <param name="mode">鏄惁鏄剧ず閿欒</param>
-        /// <returns></returns>
-        public async Task<List<Safeguard.UserPasswordListObj>> GetAllUserPassword(ShowErrorMode mode = ShowErrorMode.YES)
-        {
-            //鍏堣幏鍙栧瘑鐮�
-            var nowPw = await Safeguard.CatUserPasswordAsync(this.GetLoginToken());
-            if (nowPw == null || nowPw.catUserPasswordResponseData == null)
-            {
-                //鑾峰彇瀹夐槻瀵嗙爜澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyPasswordFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, nowPw);
-
-                if (mode == ShowErrorMode.YES)
-                {
-                    this.ShowErrorMsg(msg);
-                }
-
-                return null;
-            }
-            return nowPw.catUserPasswordResponseData.UserPasswordList;
-        }
-
-        /// <summary>
-        /// 淇敼鐢ㄦ埛瀵嗙爜(涓嶅瓨鍦ㄦ椂锛屽垯鏂板缓)
-        /// </summary>
-        /// <param name="userId">鐢ㄦ埛ID</param>
-        /// <param name="password">瀵嗙爜</param>
-        /// <param name="passWordTips">瀵嗙爜鎻愮ず</param>
-        /// <returns></returns>
-        public async Task<bool> ChangedUserPassword(int userId, string password, string passWordTips)
-        {
-            //鍒涘缓鏂扮敤鎴�
-            var result = await Safeguard.SetUserPasswordAsync(userId, password, passWordTips, this.GetLoginToken());
-            if (result == null || result.setUserPasswordResponseData == null)
-            {
-                if (userId != 5)
-                {
-                    //淇敼鐢ㄦ埛瀵嗙爜澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedUserPasswordFail);
-                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-                else
-                {
-                    //淇敼鑳佽揩瀵嗙爜澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePasswordFail);
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-            }
-            if (result.setUserPasswordResponseData.Result == 1)
-            {
-                //鐢ㄦ埛瀵嗙爜鏁板凡婊�(鏈�澶�4涓�)
-                string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordCountIsMax);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            if (result.setUserPasswordResponseData.Result == 2)
-            {
-                //瀵嗙爜闀垮害涓嶆纭�
-                string msg = Language.StringByID(R.MyInternationalizationString.uPasswordLengthIsError);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            if (result.setUserPasswordResponseData.Result == 3)
-            {
-                //鐢ㄦ埛瀵嗙爜閲嶅
-                string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsRepeat);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 鏄剧ず鏍¢獙绠$悊鍛樺瘑鐮佺殑绐楀彛
-        /// </summary>
-        /// <returns></returns>
-        public async Task<bool> ShowSafetyAdminValidatedDialog()
-        {
-            //寮忔牱鍙樻洿,涓嶅啀寮瑰嚭杈撳叆绠$悊鍛樺瘑鐮佹,鐩存帴鍙栭粯璁ゅ瘑鐮乤dmin
-            //0:瀵嗙爜閿欒  1:姝e父 - 1:寮傚父
-            var result = await this.AdminLogin("admin", ShowErrorMode.NO);
-            if (result != 1)
-            {
-                //鑾峰彇鎵ц鏉冮檺澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetActionAuthorityFail);
-                this.ShowTipMsg(msg);
-                if (result == 0)
-                {
-                    //閲嶇疆瀵嗙爜
-                    await DoResetAdministratorPsw("admin");
-                }
-            }
-            return result == 1;
-        }
-
-        /// <summary>
-        /// 妫�娴嬫槸鍚﹀凡缁忛厤缃湁鐢ㄦ埛瀵嗙爜(鍐呴儴浼氬脊鍑洪敊璇俊鎭�,-1:寮傚父 0:娌℃湁閰嶇疆 1:宸茬粡閰嶇疆)
-        /// </summary>
-        /// <returns></returns>
-        public async Task<int> CheckHadConfigureUserPsw()
-        {
-            var pswInfo = await this.GetAllUserPassword(ShowErrorMode.NO);
-            if (pswInfo == null)
-            {
-                //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇�
-                string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain);
-                this.ShowTipMsg(msg);
-                return -1;
-            }
-            foreach (var data in pswInfo)
-            {
-                //4涓敤鎴峰瘑鐮�
-                if (data.UserId >= 1 && data.UserId <= 4)
-                {
-                    return 1;
-                }
-            }
-            return 0;
-        }
-
-        /// <summary>
-        /// 娣诲姞瀵嗙爜鐨勫娉�
-        /// </summary>
-        /// <param name="userId">鐢ㄦ埛ID</param>
-        /// <param name="password">缃戝叧璇撮渶瑕佸師鏉ョ殑瀵嗙爜,涔熶笉鐭ラ亾涓轰粈涔�</param>
-        /// <param name="passWordTips">瀵嗙爜澶囨敞</param>
-        /// <returns></returns>
-        public async Task<bool> AddPassWordTips(int userId, string password, string passWordTips)
-        {
-            var result = await Safeguard.SetPassWordTipsAsync(userId, password, passWordTips, this.GetLoginToken());
-            if (result == null || result.setUserPasswordResponseData == null)
-            {
-                //淇敼澶囨敞淇℃伅澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            if (result.setUserPasswordResponseData.Result != 0)
-            {
-                //淇敼澶囨敞淇℃伅澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            return true;
-        }
-
-        #endregion
-
-        #region 鈻� 鎶ヨ鐩爣___________________________
-
-        /// <summary>
-        /// 娣诲姞鎶ヨ鐩爣鍒板畨闃�
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <param name="listAction">娣诲姞鐨勭洰鏍�</param>
-        /// <returns></returns>
-        public async Task<bool> AddAlarmTagetToSafety(int ZoneId, List<Safeguard.AlarmActionObj> listAction)
-        {
-            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode != null)
-            {
-                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶娣诲姞璁惧
-                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotAddDeviceInGarrisonMode);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            //楠岃瘉韬唤
-            bool login = await this.ShowSafetyAdminValidatedDialog();
-            if (login == false)
-            {
-                return false;
-            }
-
-            if (ZoneId > 3)
-            {
-                ZoneId = 3;
-            }
-            var saveData = new Safeguard.AddZoneActionData();
-            saveData.ActionType = ZoneId;
-            saveData.Actions = listAction;
-            saveData.LoginToken = this.GetLoginToken();
-
-            //娣诲姞鎶ヨ鐩爣鍒板畨闃�
-            var result = await Safeguard.AddZoneActionAsync(saveData);
-            if (result == null || result.addZoneActionResponseData == null || result.addZoneActionResponseData.Result == 1)
-            {
-                //娣诲姞鎶ヨ鐩爣澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uAddAlarmTargetFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-
-                return false;
-            }
-            foreach (var data in result.addZoneActionResponseData.Actions)
-            {
-                if (data.Status == "1")
-                {
-                    if (data.Type == "0")
-                    {
-                        var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint);
-                        string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
-                        //鐩爣璁惧涓嶅瓨鍦�
-                        msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
-                        this.ShowTipMsg(msg);
-                    }
-                    else if (data.Type == "1")
-                    {
-                        var scene = Common.SceneRoomUI.AllSceneRoomUIList.Find((obj) => obj.sceneUI.Id == data.ScenesId);
-                        if (scene != null)
-                        {
-                            string msg = scene.sceneUI.Name + "\r\n";
-                            //鐩爣鍦烘櫙涓嶅瓨鍦�
-                            msg += Language.StringByID(R.MyInternationalizationString.uTargetSceneIsNotExsit);
-                            this.ShowTipMsg(msg);
-                        }
-                    }
-                }
-            }
-
-            //灏嗘姤璀︾洰鏍囧垪琛ㄥ姞鍏ョ紦瀛�(浠庢柊浠庣綉鍏抽偅閲岃幏鍙栨柊杩藉姞鐨勮澶�)
-            var resultData = await Safeguard.CatZoneActionAsync(ZoneId);
-            if (resultData == null
-                || resultData.catZoneActionResponseData == null
-                || resultData.catZoneActionResponseData.Result == 1)
-            {
-                //鑾峰彇鎶ヨ鐩爣鍒楄〃澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetAlarmTargetListFail);
-                this.ShowTipMsg(msg);
-                return false;
-            }
-            this.SetAlarmTargetDeviceToMemory(resultData.catZoneActionResponseData, ShowErrorMode.YES);
-
-            return true;
-        }
-
-        /// <summary>
-        /// 鍒犻櫎鎶ヨ鐩爣
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <param name="listActions">鍒犻櫎鐨勭洰鏍�</param>
-        /// <returns></returns>
-        public async Task<bool> DeleteAlarmTaget(int ZoneId, List<Safeguard.DelAlarmActionObj> listActions)
-        {
-            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode != null)
-            {
-                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶鍒犻櫎璁惧
-                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotDeleteDeviceInGarrisonMode);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            //楠岃瘉韬唤
-            bool login = await this.ShowSafetyAdminValidatedDialog();
-            if (login == false)
-            {
-                return false;
-            }
-            if (ZoneId > 3)
-            {
-                ZoneId = 3;
-            }
-            //鍙傛暟
-            var Pra = new Safeguard.DelZoneActionData();
-            Pra.ActionType = ZoneId;
-            Pra.Actions = listActions;
-            Pra.LoginToken = this.GetLoginToken();
-            //鎵ц鍒犻櫎
-            var result = await Safeguard.DelZoneActionAsync(Pra);
-            if (result == null || result.delZoneActionResponseData == null || result.delZoneActionResponseData.Result == 1)
-            {
-                //鍒犻櫎鎶ヨ鐩爣澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteAlarmTargetFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-
-                return false;
-            }
-
-            //鑾峰彇鏈湴缂撳瓨
-            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
-            {
-                return true;
-            }
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ZoneId];
-
-            //淇敼缂撳瓨
-            foreach (var device in result.delZoneActionResponseData.Actions)
-            {
-                //鍒犻櫎澶辫触
-                if (device.Status == "1")
-                {
-                    continue;
-                }
-                //璁惧
-                if (device.Type == "0")
-                {
-                    //鍒犻櫎鎶ヨ璁惧
-                    string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint);
-                    if (zoneInfo.dicAlarmDevice.ContainsKey(mainkeys) == false)
-                    {
-                        continue;
-                    }
-                    zoneInfo.dicAlarmDevice.Remove(mainkeys);
-                    zoneInfo.dicAllDevice.Remove(mainkeys);
-                }
-                //鍦烘櫙
-                else if (device.Type == "1")
-                {
-                    //鍒犻櫎鍦烘櫙
-                    if (zoneInfo.dicScenes.ContainsKey(device.ScenesId) == true)
-                    {
-                        zoneInfo.dicScenes.Remove(device.ScenesId);
-                    }
-                }
-            }
-            return true;
-        }
-
-        #endregion
-
-        #region 鈻� 鑾峰彇鍦烘櫙___________________________
-
-        /// <summary>
-        /// 鏍规嵁闃插尯ID鑾峰彇鏈湴鐨勫満鏅�
-        /// </summary>
-        /// <param name="ZoneId">闃插尯ID</param>
-        /// <returns></returns>
-        public Dictionary<int, string> GetLocalSceneByZoneID(int ZoneId)
-        {
-            if (ZoneId > 3)
-            {
-                ZoneId = 3;
-            }
-            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
-            {
-                return new Dictionary<int, string>();
-            }
-            var infoData = this.dicAllZoneInfo[ZoneId];
-            return infoData.dicScenes;
-        }
-
-        #endregion
-
-        #region 鈻� 鏃佽矾璁剧疆___________________________
-
-        /// <summary>
-        /// 鏃佽矾鐘舵�佽缃�
-        /// </summary>
-        /// <param name="zoneId">闃插尯ID</param>
-        /// <param name="device">浼犳劅鍣ㄨ澶�</param>
-        /// <param name="statu">鏃佽矾鐘舵�� -> 0:涓嶆梺璺�  1:鏃佽矾</param>
-        /// <returns></returns>
-        public async Task<bool> SetByPassStatuToSafety(int zoneId, CommonDevice device, int statu)
-        {
-            //楠岃瘉
-            bool flage = await this.ShowSafetyAdminValidatedDialog();
-            if (flage == false)
-            {
-                return false;
-            }
-
-            //鍙傛暟
-            var Pra = new Safeguard.EqByPassData();
-            Pra.ZoneId = zoneId;
-            Pra.MacAddr = device.DeviceAddr;
-            Pra.Epoint = device.DeviceEpoint;
-            Pra.IsByPass = statu;
-            Pra.LoginToken = this.GetLoginToken();
-
-            var result = await Safeguard.EqByPassAllDataAsync(Pra);
-            if (result == null || result.eqByPassResponseData != null && result.eqByPassResponseData.Result == 3)
-            {
-                //璁剧疆澶辫触,绯荤粺褰撳墠澶勪簬鎾ら槻鐘舵��
-                string msg2 = Language.StringByID(R.MyInternationalizationString.uByPassFailAndSystemInWithdrawGarrisonStatu);
-                this.ShowErrorMsg(msg2);
-                return false;
-            }
-
-            //鍏朵粬閿欒
-            if (result.eqByPassResponseData == null || result.eqByPassResponseData.Result != 0)
-            {
-                //鏃佽矾鐘舵�佽缃け璐�
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetByPassStatuFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-
-                return false;
-            }
-
-            return true;
-        }
-
-        #endregion
-
-        #region 鈻� 甯冮槻鎾ら槻___________________________
-
-        /// <summary>
-        /// 璁剧疆瀹夐槻鐨勫竷闃叉ā寮�,鎴愬姛鏃�,鍐呴儴涓嶄細鎻愮ず淇℃伅(涓嶈璋冪敤姝ゆ柟娉曟潵瀹炵幇銆愭挙闃层��)
-        /// </summary>
-        /// <param name="garrison">甯冮槻妯″紡</param>
-        /// <returns>缃戝叧鐜板湪瀹炶鐨勫竷闃叉ā寮�</returns>
-        public async Task<GarrisonMode> SetSafetyGarrisonByModel(GarrisonMode garrison)
-        {
-            //妫�娴嬪叾浠栭槻鍖洪噷闈㈡湁娌℃湁閰嶇疆鏈変紶鎰熷櫒
-            if (this.CheckHadInteriorSectorsSensor() == false)
-            {
-                //鍏朵粬闃插尯閲屾病鏈夐厤缃紶鎰熷櫒璁惧
-                string msg = Language.StringByID(R.MyInternationalizationString.uNotSensorInOtherSectors);
-                this.ShowErrorMsg(msg);
-                return GarrisonMode.None;
-            }
-
-            if (this.UserPassword == null)
-            {
-                var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword);
-                if (data != null)
-                {
-                    this.UserPassword = System.Text.Encoding.UTF8.GetString(data);
-                }
-            }
-            if (string.IsNullOrEmpty(this.UserPassword) == true)
-            {
-                //杈撳叆瀵嗙爜
-                string password = await this.ShowInputUserPasswordForm();
-                if (string.IsNullOrEmpty(password) == true)
-                {
-                    return GarrisonMode.None;
-                }
-                var result = await this.SetSafetyGarrisonByModel(garrison, false);
-                if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison)
-                {
-                    //淇濆瓨鍔犲瘑鐨勫瘑鐮佸埌鏈湴
-                    Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
-                }
-                return result;
-            }
-            else
-            {
-                return await this.SetSafetyGarrisonByModel(garrison, true);
-            }
-        }
-
-        /// <summary>
-        /// 璁剧疆瀹夐槻鐨勫竷闃叉ā寮�,鎴愬姛鏃�,鍐呴儴涓嶄細鎻愮ず淇℃伅(涓嶈璋冪敤姝ゆ柟娉曟潵瀹炵幇銆愭挙闃层��)
-        /// </summary>
-        /// <param name="garrison">甯冮槻妯″紡</param>
-        /// <param name="showPswForm">鐢ㄦ埛瀵嗙爜閿欒鏃讹紝鏄惁鍏佽寮瑰嚭杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�</param>
-        /// <returns>缃戝叧鐜板湪瀹炶鐨勫竷闃叉ā寮�</returns>
-        private async Task<GarrisonMode> SetSafetyGarrisonByModel(GarrisonMode garrison, bool showPswForm)
-        {
-            //鍏堟妸褰撳墠鐨勬ā寮忕粰绉婚櫎鎺�
-            var flage = await this.RemoveSafetyGarrison(garrison, showPswForm);
-            if (flage == -1)
-            {
-                return GarrisonMode.None;
-            }
-            //鍒ゆ柇鏈夋病鏈夊叾浠栭�昏緫鍘讳慨鏀逛簡甯冮槻妯″紡
-            //鎵�浠ュ啀娆¤幏鍙栨ā寮�
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode != null)
-            {
-                return GarrisonMode.None;
-            }
-
-            //鍙傛暟 
-            var Pra = new Safeguard.EnableModeData();
-            //妯″紡ID
-            Pra.ModeId = (int)garrison;
-            //妫�鏌ラ槻鍖鸿澶囨渶杩戜笂鎶ョ殑瀹夐槻淇℃伅鐘舵�佽繘琛屽竷闃�
-            Pra.CheckIASStatus = 1;
-            //姘镐箙甯冮槻锛岀洿鍒版挙闃�
-            Pra.Setting = 1;
-            //鐢ㄦ埛瀵嗙爜
-            Pra.UserPassword = this.UserPassword;
-
-            //鎵ц甯冮槻
-            var result = await Safeguard.EnableModeAsync(Pra);
-            if (result == null || result.enableModeResponseData == null)
-            {
-                //甯冮槻璁剧疆澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return GarrisonMode.RemoveGarrison;
-            }
-
-            //閿欒妫�娴�
-            if (result.enableModeResponseData.Result == 1)
-            {
-                //甯冮槻妯″紡涓嶅瓨鍦�
-                string msg = Language.StringByID(R.MyInternationalizationString.uGarrisonModeIsNotEsixt);
-                this.ShowErrorMsg(msg);
-                return GarrisonMode.RemoveGarrison;
-            }
-            else if (result.enableModeResponseData.Result == 2)
-            {
-                //娓呯┖瀵嗙爜缂撳瓨
-                this.UserPassword = null;
-
-                if (showPswForm == false)
-                {
-                    //鐢ㄦ埛瀵嗙爜閿欒鎴栨湭璁剧疆鐢ㄦ埛瀵嗙爜
-                    string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsError);
-                    this.ShowErrorMsg(msg);
-                    return GarrisonMode.RemoveGarrison;
-                }
-                else
-                {
-                    //閲嶆柊鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�
-                    string password = await this.ShowInputUserPasswordForm();
-                    if (string.IsNullOrEmpty(password) == true)
-                    {
-                        return GarrisonMode.RemoveGarrison;
-                    }
-
-                    var result2 = await this.SetSafetyGarrisonByModel(garrison, false);
-                    if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison)
-                    {
-                        //淇濆瓨鍔犲瘑瀵嗙爜鍒版湰鍦�
-                        Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
-                    }
-                    return result2;
-                }
-            }
-            else if (result.enableModeResponseData.Result == 3)
-            {
-                //瀹夐槻璁惧鏈氨缁�
-                string msg = Language.StringByID(R.MyInternationalizationString.uSafetyDeviceDoNotReady);
-                msg += "(" + result.enableModeResponseData.IASName + ")";
-                this.ShowErrorMsg(msg);
-                return GarrisonMode.RemoveGarrison;
-            }
-            else if (result.enableModeResponseData.Result == 4)
-            {
-                //鍏朵粬甯冮槻妯″紡姝e湪鍚敤涓�
-                string msg = Language.StringByID(R.MyInternationalizationString.uOtherGarrisonIsActtion);
-                this.ShowErrorMsg(msg);
-                return (GarrisonMode)result.enableModeResponseData.ModeIdBeUsing;
-            }
-            else if (result.enableModeResponseData.Result == 5)
-            {
-                //妯″紡灞炴�т笉鍏佽澶辫兘
-                string msg = Language.StringByID(R.MyInternationalizationString.uGarrisonModeElementCanNotLostFunction);
-                this.ShowErrorMsg(msg);
-                return GarrisonMode.RemoveGarrison;
-            }
-            return garrison;
-        }
-
-        /// <summary>
-        /// 绉婚櫎褰撳墠姝e湪杩愯鐨勫竷闃叉ā寮�(鎴愬姛鏃讹紝鍐呴儴涓嶄細鎻愮ず淇℃伅)
-        /// </summary>
-        /// <param name="garrison">甯冮槻妯″紡(杩欎釜鍙橀噺鍙槸涓轰簡鍙樻洿鎻愮ず閿欒淇℃伅锛屽綋涓嶆槸鎾ら槻鏃讹紝閿欒鎻愮ず淇℃伅浼氭敼鍙�)</param>
-        /// <param name="showPswForm">鐢ㄦ埛瀵嗙爜閿欒鏃讹紝鏄惁鍏佽寮瑰嚭杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�</param>
-        /// <returns></returns>
-        public async Task<int> RemoveSafetyGarrison(GarrisonMode garrison, bool showPswForm)
-        {
-            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
-            var safetyMode = await this.GetSafetyMode();
-            if (safetyMode == null)
-            {
-                //濡傛灉鏄挙闃茬殑璇�
-                if (garrison == GarrisonMode.RemoveGarrison)
-                {
-                    //褰撳墠涓嶅瓨鍦ㄥ竷闃�
-                    string msg = Language.StringByID(R.MyInternationalizationString.uNowDoNotHadGarrison);
-                    this.ShowErrorMsg(msg);
-                    return -1;
-                }
-                //骞舵病鏈夎缃竷闃�,涔熷氨涓嶈皥浠�涔堟挙闃蹭簡
-                return 0;
-            }
-
-            //鎾ら槻鐨勬椂鍊欙紝鏃犳潯浠跺脊鍑鸿緭鍏ュ瘑鐮佹
-            if (garrison == GarrisonMode.RemoveGarrison)
-            {
-                string psw = await this.ShowInputUserPasswordForm();
-                if (string.IsNullOrEmpty(psw) == true)
-                {
-                    return -1;
-                }
-            }
-
-            //鎾ら槻
-            var result = await Safeguard.WithdrawModeAsync(this.UserPassword);
-            if (result == null || result.withdrawModeResponseData == null)
-            {
-                //鎵ц鎾ら槻鎿嶄綔鐨勬椂鍊�
-                if (garrison == GarrisonMode.RemoveGarrison)
-                {
-                    //鎾ら槻澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail);
-                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                    this.ShowErrorMsg(msg);
-                }
-                else
-                {
-                    //甯冮槻妯″紡鍙樻洿澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedGarrisonModeFail);
-                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                    this.ShowErrorMsg(msg);
-                }
-
-                return -1;
-            }
-
-            if (result.withdrawModeResponseData.Result == 2)
-            {
-                //娓呯┖瀵嗙爜缂撳瓨
-                this.UserPassword = null;
-                if (showPswForm == false || garrison == GarrisonMode.RemoveGarrison)
-                {
-                    //鐢ㄦ埛瀵嗙爜閿欒鎴栨湭璁剧疆鐢ㄦ埛瀵嗙爜
-                    string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsError);
-                    this.ShowErrorMsg(msg);
-                    return -1;
-                }
-                else
-                {
-                    //閲嶆柊鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�
-                    string password = await this.ShowInputUserPasswordForm();
-                    if (string.IsNullOrEmpty(password) == true)
-                    {
-                        return -1;
-                    }
-
-                    var result2 = await this.RemoveSafetyGarrison(garrison, false);
-                    if (result2 != -1)
-                    {
-                        //淇濆瓨鍒板姞瀵嗗瘑鐮佹湰鍦�
-                        Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
-                    }
-                    return result2;
-                }
-            }
-            else if (result.withdrawModeResponseData.Result == 3 && garrison == GarrisonMode.RemoveGarrison)
-            {
-                //褰撳墠妯″紡涓嶅彲鎾ら槻
-                string msg = Language.StringByID(R.MyInternationalizationString.uNowGarrisonCanNotRemove);
-                this.ShowErrorMsg(msg);
-                return -1;
-            }
-            return 1;
-        }
-
-        /// <summary>
-        /// 鑾峰彇褰撳墠瀹夐槻鐨勬ā寮�(鍦ㄥ锛岀瀹剁瓑绛�),濡傛灉娌℃湁甯冮槻锛屽垯杩斿洖null
-        /// </summary>
-        public async Task<Safeguard.GetModeUsingResponseData> GetSafetyMode()
-        {
-            var result = await Safeguard.GetModeUsingAsync();
-            if (result == null || result.getModeUsingResponseData == null)
-            {
-                return null;
-            }
-            if (result.getModeUsingResponseData.Result == 1)
-            {
-                return null;
-            }
-            return result.getModeUsingResponseData;
-        }
-
-        /// <summary>
-        /// 鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭晫闈�(杩斿洖null鏃朵唬琛ㄥ嚭閿欐垨鑰呭彇娑�)
-        /// </summary>
-        public async Task<string> ShowInputUserPasswordForm()
-        {
-            NumberPswInputDialogForm Dialogform = null;
-
-            bool isShowingProgressBar = false;
-            string ProgressBarText = string.Empty;
-
-            string pasword = null;
-            HdlThreadLogic.Current.RunMain(() =>
-            {
-                isShowingProgressBar = CommonPage.Loading.Visible;
-                ProgressBarText = CommonPage.Loading.Text;
-                if (isShowingProgressBar == true)
-                {
-                    //濡傛灉鍦ㄥ脊鍑烘牎楠屽瘑鐮佹鐨勬椂鍊欙紝鏄剧ず鐫�杩涘害鏉$殑璇濓紝鍏堟殏鏃跺叧闂繘搴︽潯
-                    CommonPage.Loading.Hide();
-                }
-
-                Dialogform = new NumberPswInputDialogForm();
-                Dialogform.AddForm(Language.StringByID(R.MyInternationalizationString.uPleaseInputUserPassword), 4);
-                //纭鎸夐挳
-                Dialogform.FinishInputEvent += ((textValue) =>
-                {
-                    Dialogform.CloseForm();
-                    //鐢ㄦ埛瀵嗙爜
-                    pasword = textValue;
-                    //鍔犲瘑瀵嗙爜
-                    this.UserPassword = pasword;
-                });
-            });
-            while (pasword == null)
-            {
-                if (Dialogform != null && Dialogform.Parent == null)
-                {
-                    break;
-                }
-                await Task.Delay(500);
-            }
-
-            //鎭㈠杩涘害鏉�
-            if (isShowingProgressBar == true)
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    CommonPage.Loading.Start(ProgressBarText);
-                });
-            }
-            return pasword;
-        }
-
-        /// <summary>
-        /// 妫�娴嬪叾浠栭槻鍖洪噷闈㈡湁娌℃湁閰嶇疆鏈変紶鎰熷櫒(甯冮槻浣跨敤)
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckHadInteriorSectorsSensor()
-        {
-            for (int i = 3; i <= 5; i++)
-            {
-                if (dicAllZoneInfo.ContainsKey(i) == true
-                    && dicAllZoneInfo[i].dicSensor.Count > 0)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        #endregion
-
-        #region 鈻� 淇℃伅鎺ㄩ�乢__________________________
-
-        /// <summary>
-        /// 璁剧疆鎸囧畾闃插尯鐨勪俊鎭帹閫佺姸鎬�
-        /// </summary>
-        /// <param name="zoneId">闃插尯ID</param>
-        /// <param name="statu">鐘舵��  0:鎺ㄩ��  1:涓嶆帹閫�</param>
-        /// <returns></returns>
-        public async Task<bool> SetGarrisonInformationPushStatu(int zoneId, int statu)
-        {
-            //鏍¢獙瀵嗙爜
-            bool flage = await this.ShowSafetyAdminValidatedDialog();
-            if (flage == false)
-            {
-                return false;
-            }
-
-            if (zoneId > 3)
-            {
-                zoneId = 3;
-            }
-            //鐘舵�佸彉鏇�
-            var result = await Safeguard.DisablePushMessageAsync(zoneId, statu);
-            if (result == null || result.disablePushMessageResponseData == null || result.disablePushMessageResponseData.Result == 1)
-            {
-                //璁剧疆淇℃伅鎺ㄩ�佸け璐�
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetInformationPushFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
-            {
-                return true;
-            }
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[zoneId];
-            zoneInfo.InformationPush = statu;
-
-            return true;
-        }
-
-        /// <summary>
-        /// 鑾峰彇褰撳墠闃插尯鐨勪俊鎭帹閫佺姸鎬�
-        /// </summary>
-        /// <param name="zoneId">闃插尯ID</param>
-        /// <returns>0:鎺ㄩ��  1:涓嶆帹閫�</returns>
-        public int GetGarrisonInformationPushStatu(int zoneId)
-        {
-            if (zoneId > 3)
-            {
-                zoneId = 3;
-            }
-            if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
-            {
-                return 1;
-            }
-            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[zoneId];
-            return zoneInfo.InformationPush;
-        }
-
-        #endregion
-
-        #region 鈻� 寤惰繜璁剧疆___________________________
-
-        /// <summary>
-        /// 鑾峰彇闃插尯鐨勫欢杩熸椂闂�(浠呴檺鍑哄叆闃插尯),鍑洪敊鏃惰繑鍥瀗ull
-        /// </summary>
-        /// <returns></returns>
-        public async Task<Safeguard.CatDelayTimeResponseData> GetGarrisonDelayTime()
-        {
-            //鑾峰彇
-            var result = await Safeguard.CatDelayTimeAsync();
-            if (result == null || result.catDelayTimeResponseData == null)
-            {
-                //鑾峰彇寤舵椂鏃堕棿澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetDelayTimeFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-            return result.catDelayTimeResponseData;
-        }
-
-        /// <summary>
-        /// 璁剧疆闃插尯鐨勮繘鍑哄欢杩熸椂闂� (浠呴檺鍑哄叆闃插尯),鐜版帴鍙d笉鏀寔鍗曚釜淇敼
-        /// </summary>
-        /// <param name="enterDelayTime">杩涘叆寤舵椂(绉�)</param>
-        /// <param name="goOutDelayTime">澶栧嚭寤舵椂(绉�)</param>
-        /// <returns></returns>
-        public async Task<bool> SetGarrisonDelayTime(int enterDelayTime, int goOutDelayTime)
-        {
-            //鏍¢獙瀵嗙爜
-            bool flage = await this.ShowSafetyAdminValidatedDialog();
-            if (flage == false)
-            {
-                return false;
-            }
-            //鏇存敼鏃堕棿
-            var result = await Safeguard.SetDelayTimeAsync(enterDelayTime, goOutDelayTime, this.GetLoginToken());
-            if (result == null || result.setDelayTimeResponseData == null)
-            {
-                //璁剧疆寤舵椂鏃堕棿澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uSetDelayTimeFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            return true;
-        }
-
-        #endregion
-
-        #region 鈻� 鑳佽揩璁剧疆___________________________
-
-        /// <summary>
-        /// 鑾峰彇鑳佽揩鐨勭數璇濊仈绯绘柟寮�(鑾峰彇澶辫触鏃朵細杩斿洖null)
-        /// </summary>
-        /// <returns></returns>
-        public async Task<Safeguard.CheckCoercePhoneNumberResponseData> GetCoercePhoneNumber()
-        {
-            //鑾峰彇
-            var result = await Safeguard.CheckCoercePhoneNumberAsync();
-            if (result == null || result.checkCoercePhoneNumberResponseData == null)
-            {
-                //鑾峰彇鑳佽揩鑱旂郴鏂瑰紡淇℃伅澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetCoercePhoneNumberFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-            //娌℃湁鏁版嵁
-            if (result.checkCoercePhoneNumberResponseData.Result == 1)
-            {
-                return null;
-            }
-            return result.checkCoercePhoneNumberResponseData;
-        }
-
-        /// <summary>
-        /// 璁剧疆鑳佽揩鐨勮仈绯讳汉鏂瑰紡
-        /// </summary>
-        /// <param name="listPhone">鍦板尯鐮�-鑱旂郴鏂瑰紡</param>
-        /// <param name="listNote">鑱旂郴浜哄娉�</param>
-        /// <param name="addPhone">鏄惁鏄柊寤鸿仈绯讳汉,false鐨勬椂鍊�,鍙敼澶囨敞</param>
-        /// <returns></returns>
-        public async Task<bool> SetCoercePhoneNumber(List<string> listPhone, List<string> listNote, bool addPhone = true)
-        {
-            if (addPhone == true)
-            {
-                var Pra = new Safeguard.SetCoercePhoneNumberData();
-                var Actonobj = new Safeguard.PushTargetActionObj();
-                Actonobj.Type = 2;
-                Pra.Actions.Add(Actonobj);
-                Pra.LoginToken = this.GetLoginToken();
-
-                for (int i = 0; i < listPhone.Count; i++)
-                {
-                    var phoneInfo = new Safeguard.PushTargetInfo();
-                    Actonobj.PushTarget.Add(phoneInfo);
-                    //鐢佃瘽鍙风爜
-                    phoneInfo.PushNumber = listPhone[i];
-                }
-                var result = await Safeguard.SetCoercePhoneNumberAsync(Pra);
-                if (result == null || result.setCoercePhoneNumberResponseData == null || result.setCoercePhoneNumberResponseData.Result != 0)
-                {
-                    //淇敼鑳佽揩鑱旂郴鏂瑰紡澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePhoneNumberFail);
-                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-            }
-            for (int i = 0; i < listNote.Count; i++)
-            {
-                var result = await Safeguard.SetCoercePhoneNumberNoteAsync(listPhone[i], listNote[i]);
-                if (result == null)
-                {
-                    //淇敼澶囨敞淇℃伅澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
-                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-                if (result.Result == -2)
-                {
-                    //閿欒:缃戝叧瀵硅薄涓㈠け
-                    string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-                if (result.Result != 0)
-                {
-                    //淇敼澶囨敞淇℃伅澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
-                    this.ShowErrorMsg(msg);
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// 鍒犻櫎鑳佽揩鐨勮仈绯讳汉鏂瑰紡
-        /// </summary>
-        /// <param name="areaCode"></param>
-        /// <param name="phoneNum"></param>
-        /// <returns></returns>
-        public async Task<bool> DeleteCoercePhoneNumber(string areaCode, string phoneNum)
-        {
-            var Pra = new Safeguard.DelCoercePhoneNumberData();
-            var Actonobj = new Safeguard.PushTargetActionObj();
-            Actonobj.Type = 2;
-            Pra.Actions.Add(Actonobj);
-            Pra.LoginToken = this.GetLoginToken();
-
-            var phoneInfo = new Safeguard.PushTargetInfo();
-            Actonobj.PushTarget.Add(phoneInfo);
-            //鐢佃瘽鍙风爜
-            phoneInfo.PushNumber = areaCode + "-" + phoneNum;
-
-            var result = await Safeguard.DelCoercePhoneNumberAsync(Pra);
-            if (result == null || result.delCoercePhoneNumberResponseData == null || result.delCoercePhoneNumberResponseData.Result != 0)
-            {
-                //鍒犻櫎鑳佽揩鑱旂郴鏂瑰紡澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCoercePhoneNumberFail);
-                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
-                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
-
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-
-            return true;
-        }
-
-        /// <summary>
-        /// 缁欒仈绯诲彿鐮佹坊鍔犲娉ㄧ殑淇℃伅
-        /// </summary>
-        private class AddPushNumberNoteInfo
-        {
-            /// <summary>
-            /// 鍥哄畾253
-            /// </summary>
-            public int ActionType = 253;
-            /// <summary>
-            /// LoginToken
-            /// </summary>
-            public string LoginToken = string.Empty;
-            /// <summary>
-            /// 鍦板尯鐮�-鑱旂郴鏂瑰紡
-            /// </summary>
-            public string PushNumber = string.Empty;
-            /// <summary>
-            /// 鑱旂郴浜哄彿鐮佸娉紝鏈�澶�63byte
-            /// </summary>
-            public string PushNumberNote = string.Empty;
-        }
-
-        #endregion
-
-        #region 鈻� 鎶ヨ鐩爣鐘舵�佺殑缈昏瘧鏂囨湰_____________
-
-        /// <summary>
-        /// 鑾峰彇鐏厜绫诲瀷鐨勬姤璀︾洰鏍囩殑鐘舵�佹枃鏈�
-        /// </summary>
-        /// <param name="listTaskInfo">鍔ㄤ綔瀵硅薄,鍙互涓虹┖</param>
-        /// <returns></returns>
-        public string GetLightAlarmStatuText(List<Safeguard.TaskListInfo> listTaskInfo)
-        {
-            if (listTaskInfo == null || listTaskInfo.Count == 0)
-            {
-                //鏃犲姩浣�
-                return Language.StringByID(R.MyInternationalizationString.uNotAction);
-            }
-            //瑕佽�冭檻瀹冪殑鎺掑垪椤哄簭(鍙互鎸夐渶姹傚彉鏇寸紪鍙�)
-            Dictionary<int, string> dicSort = new Dictionary<int, string>();
-            //寮�鍏崇殑浣嶇疆缂栧彿
-            int ControlNo = 0;
-            //鐧惧垎姣旂殑浣嶇疆缂栧彿
-            int persentNo = 1;
-
-            foreach (var info in listTaskInfo)
-            {
-                //寮�鍏虫帶鍒�
-                if (info.TaskType == 1)
-                {
-                    if (info.Data1 == 1)
-                    {
-                        //寮�
-                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleOpen);
-                    }
-                    else
-                    {
-                        //鍏�
-                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
-                    }
-                }
-                //浜害璋冭妭
-                else if (info.TaskType == 3)
-                {
-                    dicSort[persentNo] = info.Data1 + "%";
-                }
-                //绐楀笜璁惧(瀹冪殑寮�鍏冲拰寮�鍏虫帶鍒舵槸鍙嶈繃鏉ョ殑)
-                else if (info.TaskType == 6)
-                {
-                    if (info.Data1 == 0)
-                    {
-                        //寮�
-                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleOpen);
-                    }
-                    else if (info.Data1 == 1)
-                    {
-                        //鍏�
-                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
-                    }
-                    else if (info.Data1 == 5)
-                    {
-                        //绐楀笜鐧惧垎姣�
-                        dicSort[persentNo] = info.Data2 + "%";
-                    }
-                }
-            }
-
-            //鎷兼帴鏂囨湰
-            string txtvalue = string.Empty;
-            for (int i = 0; i < dicSort.Count; i++)
-            {
-                txtvalue += dicSort[i] + " ";
-            }
-
-            return txtvalue.Trim();
-        }
-
-        #endregion
-
-        #region 鈻� 閲嶇疆绠$悊鍛樺瘑鐮乢____________________
-
-        /// <summary>
-        /// 閲嶇疆绠$悊鍛樺瘑鐮�
-        /// </summary>
-        /// <param name="password">鏂板瘑鐮�</param>
-        /// <returns></returns>
-        private async Task<bool> DoResetAdministratorPsw(string password)
-        {
-            var realWay = ZigBee.Device.ZbGateway.MainGateWay;
-            if (realWay == null)
-            {
-                //閿欒:缃戝叧瀵硅薄涓㈠け
-                //string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
-                //this.ShowTipMsg(msg);
-                return false;
-            }
-            //鏄惁杈炬垚涓柇鐨勬椂鏈�
-            bool canBreak = false;
-            bool success = false;
-            //瓒呮椂鏃堕棿
-            int TimeOut = 0;
-            string checkTopic = HdlGatewayLogic.Current.GetGatewayId(realWay) + "/Security/AdminSetNewPassword_Respon";
-            Action<string, string> getResultAction = (topic, message) =>
-            {
-                try
-                {
-                    if (topic == checkTopic)
-                    {
-                        TimeOut = 0;
-                        var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
-                        var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
-                        success = result == 0;
-                        canBreak = true;
-                    }
-                }
-                catch { }
-            };
-
-            realWay.Actions += getResultAction;
-            try
-            {
-                var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 4033 } };
-                var data = new Newtonsoft.Json.Linq.JObject { { "HomeId", Common.Config.Instance.HomeId }, { "Password", password } };
-                jObject.Add("Data", data);
-                realWay.Send("Security/AdminSetNewPassword", jObject.ToString());
-            }
-            catch
-            {
-                canBreak = true;
-                //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇�
-                //string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain);
-                //this.ShowTipMsg(msg);
-            }
-
-            while (canBreak == false && TimeOut < 20)
-            {
-                await Task.Delay(100);
-                TimeOut++;
-            }
-
-            realWay.Actions -= getResultAction;
-            getResultAction = null;
-
-            if (TimeOut >= 20)
-            {
-                //閲嶇疆绠$悊鍛樺瘑鐮佸け璐�(缃戝叧鍥炲瓒呮椂)
-                //string msg = Language.StringByID(R.MyInternationalizationString.uResetAdministratorPswFail);
-                //msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
-                //this.ShowTipMsg(msg);
-                return false;
-            }
-            return success;
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 鑾峰彇鎵�鏈夐槻鍖虹殑ID(榛樿鏄�1锝�5)
-        /// </summary>
-        /// <returns></returns>
-        private List<int> GetAllZoneId()
-        {
-            //闃插尯id
-            //1锛�24灏忔椂闃插尯
-            //2锛�24灏忔椂闈欓煶闃插尯
-            //3锛氬嚭鍏ラ槻鍖�
-            //4锛氬唴閮ㄩ槻鍖�
-            //5锛氬懆鐣岄槻鍖�
-            List<int> list = new List<int>() { 1, 2, 3, 4, 5 };
-            return list;
-        }
-
-        /// <summary>
-        /// 鑾峰彇闃插尯鐨勭炕璇戝悕瀛�
-        /// </summary>
-        /// <param name="ZoneID"></param>
-        /// <returns></returns>
-        public string GetGarrisonText(int ZoneID)
-        {
-            if (ZoneID == 1)
-            {
-                //24灏忔椂闃插尯
-                return Language.StringByID(R.MyInternationalizationString.u24HourSectors);
-            }
-            else if (ZoneID == 2)
-            {
-                //闈欓煶闃插尯
-                return Language.StringByID(R.MyInternationalizationString.uMuteSectors);
-            }
-            else if (ZoneID == 3)
-            {
-                //鍑哄叆闃插尯
-                return Language.StringByID(R.MyInternationalizationString.uInAndOutSectors);
-            }
-            else if (ZoneID == 4)
-            {
-                //鍐呴儴闃插尯
-                return Language.StringByID(R.MyInternationalizationString.uInteriorSectors);
-            }
-            else if (ZoneID == 5)
-            {
-                //鍛ㄧ晫闃插尯
-                return Language.StringByID(R.MyInternationalizationString.uPerimeterSectors);
-            }
-            return string.Empty;
-        }
-
-        /// <summary>
-        /// 鏄剧ず閿欒淇℃伅绐楀彛
-        /// </summary>
-        /// <param name="msg"></param>
-        private void ShowErrorMsg(string msg)
-        {
-            Application.RunOnMainThread(() =>
-            {
-                var contr = new ShowMsgControl(ShowMsgType.Error, msg);
-                contr.Show();
-            });
-        }
-
-        /// <summary>
-        /// 鏄剧ず姝e父淇℃伅绐楀彛
-        /// </summary>
-        /// <param name="msg"></param>
-        private void ShowNormalMsg(string msg)
-        {
-            Application.RunOnMainThread(() =>
-            {
-                var contr = new ShowMsgControl(ShowMsgType.Normal, msg);
-                contr.Show();
-            });
-        }
-
-        /// <summary>
-        /// 鏄剧ずTip绐楀彛
-        /// </summary>
-        /// <param name="msg"></param>
-        private void ShowTipMsg(string msg)
-        {
-            Application.RunOnMainThread(() =>
-            {
-                var control = new ShowMsgControl(ShowMsgType.Tip, msg);
-                control.Show();
-            });
-        }
-
-        /// <summary>
-        /// 鑾峰彇璁惧鐨勫敮涓�涓婚敭
-        /// </summary>
-        /// <param name="device"></param>
-        /// <returns></returns>
-        private string GetDeviceMainKeys(CommonDevice device)
-        {
-            return Common.LocalDevice.Current.GetDeviceMainKeys(device);
-        }
-
-        /// <summary>
-        /// 鑾峰彇鐧婚檰鑰呯殑Token(濂藉儚绠$悊鍛樼櫥闄嗙殑鏃跺��,闇�瑕佸彉鏇碩oken,鎵�浠ユ殏涓斿畾涔変竴涓嚱鏁板嚭鏉�)
-        /// </summary>
-        /// <returns></returns>
-        public string GetLoginToken()
-        {
-            //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
-            //return UserCenterLogic.GetConnectMainToken();
-            return Config.Instance.Token;
-        }
-
-        #endregion
-
-        #region 鈻� 缁撴瀯浣揰____________________________
-
-        /// <summary>
-        /// 鍐呴儴浣跨敤锛屽畨闃查槻鍖虹殑涓�浜涗俊鎭�
-        /// </summary>
-        private class SafeguardZoneInfo
-        {
-            /// <summary>
-            /// 闃插尯id銆�
-            /// </summary>
-            public int ZoneId;
-            /// <summary>
-            /// 甯冮槻闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�
-            /// </summary>
-            public string ZoneName;
-            /// <summary>
-            /// 淇℃伅鎺ㄩ�� 0:鎺ㄩ��  1:涓嶆帹閫� (鍙湁闃插尯ID:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑)
-            /// </summary>
-            public int InformationPush = 1;
-            /// <summary>
-            /// 浼犳劅鍣ㄨ澶囩殑淇℃伅(keys:璁惧涓婚敭)
-            /// </summary>
-            public Dictionary<string, Safeguard.ZoneDeviceListData> dicSensor = new Dictionary<string, Safeguard.ZoneDeviceListData>();
-            /// <summary>
-            /// 璇ラ槻鍖轰笅鍏ㄩ儴璁惧鏂囦欢璺緞(keys:璁惧涓婚敭,value:璁惧鏂囦欢璺緞)
-            /// </summary>
-            public Dictionary<string, string> dicAllDevice = new Dictionary<string, string>();
-            /// <summary>
-            /// 璇ラ槻鍖轰笅闈㈢殑鎶ヨ璁惧(keys:璁惧涓婚敭),锛滃彧鏈夐槻鍖篒D:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑锛�
-            /// </summary>
-            public Dictionary<string, Safeguard.CatActionResponseObj> dicAlarmDevice = new Dictionary<string, Safeguard.CatActionResponseObj>();
-            /// <summary>
-            /// 璇ラ槻鍖轰笅闈㈢殑鍦烘櫙(keys:鍦烘櫙No),锛滃彧鏈夐槻鍖篒D:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑锛�
-            /// </summary>
-            public Dictionary<int, string> dicScenes = new Dictionary<int, string>();
-        }
-
-        #endregion
-    }
-}
+锘縰sing Newtonsoft.Json;
+using Shared.Common;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// <para>瀹夐槻鏈湴缂撳瓨(浠g爜浣跨敤)</para>
+    /// <para>闃插尯ID(ZoneId)锛�</para>
+    /// <para>1锛�24灏忔椂闃插尯  2锛�24灏忔椂闈欓煶闃插尯  3锛氬嚭鍏ラ槻鍖�  4锛氬唴閮ㄩ槻鍖�  5锛氬懆鐣岄槻鍖�</para>
+    /// <para>闃插尯妯″紡ID(ActionType -> 闃插尯ID鎹㈢畻:ZoneId=3,4,5閮藉綋鍋�3澶勭悊)锛�</para>
+    /// <para>1锛�24灏忔椂闃插尯  2锛氶潤闊抽槻鍖�  3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級</para>
+    /// <para>甯冮槻妯″紡ID(GarrisonMode)锛�</para>
+    /// <para>1锛氬湪瀹跺竷闃� 鎴栬�� 甯冮槻(鍐呴儴闃插尯娌℃湁璁剧疆鐨勬椂鍊�)  2锛氱瀹跺竷闃�</para>
+    /// </summary>
+    public class HdlSafeguardLogic
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鏈湴瀹夐槻鏁版嵁
+        /// </summary>
+        private static HdlSafeguardLogic m_Current = null;
+        /// <summary>
+        /// 鏈湴瀹夐槻鏁版嵁
+        /// </summary>
+        public static HdlSafeguardLogic Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new HdlSafeguardLogic();
+                }
+                return m_Current;
+            }
+            set
+            {
+                m_Current = value;
+            }
+        }
+
+        /// <summary>
+        /// 褰撳墠鐨勫竷闃叉ā寮�(娉ㄦ剰,杩欎釜涓滆タ鍙粰瀹夐槻涓荤晫闈㈠垵濮嬪寲鐨勬椂鍊欎娇鐢紒锛�)
+        /// </summary>
+        public GarrisonMode NowGarrisonMode = GarrisonMode.None;
+        /// <summary>
+        /// 鐢ㄦ埛瀵嗙爜鐨勭紦瀛�
+        /// </summary>
+        private string UserPassword = null;
+        /// <summary>
+        /// 瀹夐槻鏁版嵁缂撳瓨
+        /// </summary>
+        private Dictionary<int, SafeguardZoneInfo> dicAllZoneInfo = new Dictionary<int, SafeguardZoneInfo>();
+
+        #endregion
+
+        #region 鈻� 鍒锋柊瀹夐槻___________________________
+
+        /// <summary>
+        /// 浠庢柊浠庣綉鍏抽偅閲岃幏鍙栨暟鎹�(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
+        /// </summary>
+        /// <returns></returns>
+        public async Task<bool> ReFreshByGateway()
+        {
+            //鍏堟竻绌�
+            this.dicAllZoneInfo.Clear();
+            var mainGateway = ZbGateway.MainGateWay;
+            if (mainGateway == null)
+            {
+                //閿欒:缃戝叧瀵硅薄涓㈠け
+                string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
+                this.ShowTipMsg(msg);
+                return false;
+            }
+            var mainWayId = mainGateway.GwId;
+
+            //涓婚鏁板浐瀹�5+3+1
+            int topicCount = 9;
+            //閿欒
+            bool error = false;
+
+            //闃插尯璁惧淇℃伅
+            var listDevice = new List<Safeguard.GetZoneDeviceListByIdResponData>();
+            //鎶ヨ鐩爣
+            var listAlarm = new List<Safeguard.CatZoneActionResponseData>();
+            //瀹夐槻妯″紡
+            var listMode = new List<Safeguard.GetModeUsingResponseData>();
+
+            Action<string, string> action = (topic, message) =>
+            {
+                var gatewayID = topic.Split('/')[0];
+                if (gatewayID != mainWayId)
+                {
+                    return;
+                }
+
+                //妫�娴嬪叡閫氶敊璇�
+                if (topic == gatewayID + "/" + "Error_Respon")
+                {
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+
+                    var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
+                    if (temp != null)
+                    {
+                        string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error);
+                        if (msg != null)
+                        {
+                            this.ShowTipMsg(msg);
+                        }
+                    }
+                    error = true;
+                }
+                //闃插尯璁惧淇℃伅
+                if (topic == gatewayID + "/Security/GetZoneDeviceList_Respon")
+                {
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                    if (result == 0)
+                    {
+                        var data = JsonConvert.DeserializeObject<Safeguard.GetZoneDeviceListByIdResponData>(jobject["Data"].ToString());
+                        if (data != null)
+                        {
+                            //灏嗛槻鍖轰紶鎰熷櫒璁惧鍒楄〃鍔犲叆缂撳瓨
+                            listDevice.Add(data);
+                            topicCount--;
+                            return;
+                        }
+                    }
+                    error = true;
+                }
+                //闃插尯鎶ヨ鐩爣
+                if (topic == gatewayID + "/Security/GetZoneAction_Respon")
+                {
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                    if (result == 0)
+                    {
+                        var data = JsonConvert.DeserializeObject<Safeguard.CatZoneActionResponseData>(jobject["Data"].ToString());
+                        if (data != null)
+                        {
+                            //灏嗛槻鍖烘姤璀︾洰鏍囧姞鍏ョ紦瀛�
+                            listAlarm.Add(data);
+                            topicCount--;
+                            return;
+                        }
+                    }
+                    error = true;
+                }
+                //褰撳墠甯冮槻妯″紡
+                if (topic == gatewayID + "/Security/GetCurrentMode_Respon")
+                {
+                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                    var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                    if (result != 0)
+                    {
+                        //褰撳墠娌℃湁妯′豢妯″紡
+                        this.NowGarrisonMode = GarrisonMode.None;
+                    }
+                    else
+                    {
+                        var data = JsonConvert.DeserializeObject<Safeguard.GetModeUsingResponseData>(jobject["Data"].ToString());
+                        if (data != null)
+                        {
+                            //璁剧疆褰撳墠妯′豢妯″紡
+                            this.NowGarrisonMode = (GarrisonMode)data.ModeId;
+                        }
+                    }
+                    topicCount--;
+                }
+            };
+            mainGateway.Actions += action;
+            try
+            {
+                var jObject = new Newtonsoft.Json.Linq.JObject() { { "Cluster_ID", 0 }, { "Command", 4036 } };
+                mainGateway.Send("Security/GetSecurityInfo", jObject.ToString());
+            }
+            catch { }
+
+            var dateTime = DateTime.Now;
+            while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
+            {
+                //if (error == true) { break; }
+                if (topicCount <= 0)
+                {
+                    //9娆′富棰樺叏閮ㄦ帴鏀跺畬鎴�
+                    await Task.Delay(1000);
+                    break;
+                }
+                await Task.Delay(50);
+            }
+            mainGateway.Actions -= action;
+
+            if (topicCount > 0)
+            {
+                //鑾峰彇闃插尯淇℃伅澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyInfoFail);
+                this.ShowTipMsg(msg);
+                return false;
+            }
+
+            //灏嗛槻鍖轰紶鎰熷櫒璁惧鍒楄〃鍔犲叆缂撳瓨
+            foreach (var data in listDevice)
+            {
+                this.SetZoneSensorDeviceToMemory(data);
+            }
+            //灏嗛槻鍖烘姤璀︾洰鏍囧姞鍏ョ紦瀛�
+            foreach (var data in listAlarm)
+            {
+                this.SetAlarmTargetDeviceToMemory(data);
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 灏嗛槻鍖鸿澶�(浼犳劅鍣�)鍒楄〃鍔犲叆缂撳瓨
+        /// </summary>
+        /// <param name="allData">闃插尯鏁版嵁</param>
+        private void SetZoneSensorDeviceToMemory(Safeguard.GetZoneDeviceListByIdResponData allData)
+        {
+            if (this.dicAllZoneInfo.ContainsKey(allData.ZoneId) == false)
+            {
+                this.dicAllZoneInfo[allData.ZoneId] = new SafeguardZoneInfo();
+            }
+
+            //璁剧疆鍩烘湰淇℃伅
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[allData.ZoneId];
+            zoneInfo.ZoneId = allData.ZoneId;
+            zoneInfo.ZoneName = allData.ZoneName;
+
+            //淇℃伅鎺ㄩ��
+            zoneInfo.InformationPush = allData.IsDisablePushMessage;
+
+            //澶勭悊璁惧
+            foreach (var data2 in allData.DeviceList)
+            {
+                string mainKey = LocalDevice.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint);
+                //浼犳劅鍣ㄨ澶囦俊鎭�
+                var Deviceinfo = new Safeguard.ZoneDeviceListData();
+                Deviceinfo.IsBypass = data2.IsBypass;
+                Deviceinfo.MomentStatus = data2.MomentStatus;
+                Deviceinfo.TriggerZoneStatus = data2.TriggerZoneStatus;
+                Deviceinfo.MacAddr = data2.MacAddr;
+                Deviceinfo.Epoint = data2.Epoint;
+                zoneInfo.dicSensor[mainKey] = Deviceinfo;
+
+                //鏈湴鏄惁鏈夎繖涓澶�
+                CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
+                if (device != null)
+                {
+                    //鍏ㄩ儴璁惧
+                    zoneInfo.dicAllDevice[mainKey] = device.FilePath;
+                }
+                else
+                {
+                    //鍏ㄩ儴璁惧(缂哄け鐨勬湭鐭ヨ澶�)
+                    var tempDevice = new CommonDevice();
+                    tempDevice.DeviceAddr = data2.MacAddr;
+                    tempDevice.DeviceEpoint = data2.Epoint;
+                    zoneInfo.dicAllDevice[mainKey] = tempDevice.FilePath;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 灏嗘姤璀︾洰鏍囧垪琛ㄥ姞鍏ョ紦瀛�
+        /// </summary>
+        /// <param name="resData">
+        /// <para>1锛�24灏忔椂闃插尯瑙﹀彂鍔ㄤ綔</para>
+        /// <para>2锛�24灏忔椂闈欓煶闃插尯瑙﹀彂鍔ㄤ綔</para>
+        /// <para>3锛氬叾浠栭槻鍖猴紙鍑哄叆闃插尯銆佸唴閮ㄩ槻鍖恒�佸懆鐣岄槻鍖猴級瑙﹀彂鍔ㄤ綔</para>
+        /// </param>
+        /// <param name="mode">鏄惁鏄剧ず閿欒</param>
+        /// <returns></returns>
+        private void SetAlarmTargetDeviceToMemory(Safeguard.CatZoneActionResponseData resData, ShowErrorMode mode = ShowErrorMode.NO)
+        {
+            int ActionType = resData.ActionType;
+            if (this.dicAllZoneInfo.ContainsKey(ActionType) == false)
+            {
+                this.dicAllZoneInfo[ActionType] = new SafeguardZoneInfo();
+                //璁剧疆鍩烘湰淇℃伅
+                this.dicAllZoneInfo[ActionType].ZoneId = ActionType;
+            }
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ActionType];
+
+            zoneInfo.dicAlarmDevice.Clear();
+            zoneInfo.dicScenes.Clear();
+
+            foreach (var data in resData.Actions)
+            {
+                //璁惧
+                if (data.Type == 0)
+                {
+                    //鏈湴鏄惁鏈夎繖涓澶�
+                    string mainKey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
+                    //鎶ヨ淇℃伅
+                    zoneInfo.dicAlarmDevice[mainKey] = data;
+                    CommonDevice device = LocalDevice.Current.GetDevice(mainKey);
+                    if (device != null)
+                    {
+                        //鍏ㄩ儴璁惧
+                        zoneInfo.dicAllDevice[mainKey] = device.FilePath;
+                    }
+                    else
+                    {
+                        //鍏ㄩ儴璁惧(缂哄け鐨勬湭鐭ヨ澶�)
+                        var tempDevice = new CommonDevice();
+                        tempDevice.DeviceAddr = data.DeviceAddr;
+                        tempDevice.DeviceEpoint = data.Epoint;
+                        zoneInfo.dicAllDevice[mainKey] = tempDevice.FilePath;
+                    }
+                }
+                //鍦烘櫙
+                else if (data.Type == 1)
+                {
+                    //鍦烘櫙
+                    zoneInfo.dicScenes[data.ScenesId] = data.ESName;
+                }
+            }
+        }
+        #endregion
+
+        #region 鈻� 鑾峰彇璁惧___________________________
+
+        /// <summary>
+        /// 鑾峰彇鎸囧畾闃插尯鐨勬墍鏈変紶鎰熷櫒璁惧鐨勪俊鎭�
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <returns></returns>
+        public List<Safeguard.ZoneDeviceListData> GetSensorDevicesInfoByZoonID(int zoonId)
+        {
+            var list = new List<Safeguard.ZoneDeviceListData>();
+            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
+            {
+                return list;
+            }
+            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
+            foreach (var data in info.dicSensor.Values)
+            {
+                list.Add(data);
+            }
+
+            return list;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍏ㄩ儴鐨勪紶鎰熷櫒璁惧鐨勪俊鎭�(鎸夐槻鍖哄垎缁�)
+        /// </summary>
+        /// <returns></returns>
+        public Dictionary<int, List<Safeguard.ZoneDeviceListData>> GetAllSensorDeviceInfo()
+        {
+            var dic = new Dictionary<int, List<Safeguard.ZoneDeviceListData>>();
+
+            foreach (int ZoonId in this.dicAllZoneInfo.Keys)
+            {
+                List<Safeguard.ZoneDeviceListData> list = this.GetSensorDevicesInfoByZoonID(ZoonId);
+                if (list.Count > 0)
+                {
+                    dic[ZoonId] = list;
+                }
+            }
+            return dic;
+        }
+
+        /// <summary>
+        /// 鏍规嵁闃插尯ID鑾峰彇鏈湴鎶ヨ鐩爣
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <returns></returns>
+        public List<Safeguard.CatActionResponseObj> GetLocalAlarmTargetInfoByZoneId(int ZoneId)
+        {
+            if (ZoneId > 3)
+            {
+                ZoneId = 3;
+            }
+            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
+            {
+                return new List<Safeguard.CatActionResponseObj>();
+            }
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ZoneId];
+
+            //浼樺厛鍦烘櫙鍚�
+            var list = new List<Safeguard.CatActionResponseObj>();
+            foreach (int sceneId in zoneInfo.dicScenes.Keys)
+            {
+                var objData = new Safeguard.CatActionResponseObj();
+                objData.Type = 1;
+                objData.ScenesId = sceneId;
+                objData.ESName = zoneInfo.dicScenes[sceneId];
+
+                list.Add(objData);
+            }
+            foreach (var data in zoneInfo.dicAlarmDevice.Values)
+            {
+                list.Add(data);
+            }
+            return list;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎸囧畾浼犳劅鍣ㄦ墍澶勭殑闃插尯ID(涓嶅瓨鍦ㄥ垯杩斿洖-1)
+        /// </summary>
+        /// <param name="device">鎸囧畾浼犳劅鍣ㄨ澶�</param>
+        /// <returns></returns>
+        public int GetZoneIdByIASZone(CommonDevice device)
+        {
+            string mainkey = this.GetDeviceMainKeys(device);
+            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
+            {
+                if (info.dicSensor.ContainsKey(mainkey) == true)
+                {
+                    return info.ZoneId;
+                }
+            }
+            return -1;
+        }
+
+        #endregion
+
+        #region 鈻� 娣诲姞浼犳劅鍣╛________________________
+
+        /// <summary>
+        /// 娣诲姞浼犳劅鍣ㄨ澶囧埌闃插尯(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <param name="listdevice">璁惧鍒楄〃</param>
+        public async Task<bool> AddSensorDevice(int zoonId, List<CommonDevice> listdevice)
+        {
+            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode != null)
+            {
+                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶娣诲姞璁惧
+                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotAddDeviceInGarrisonMode);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            //鏍¢獙瀵嗙爜
+            bool result = await this.ShowSafetyAdminValidatedDialog();
+            if (result == false)
+            {
+                return false;
+            }
+
+            if (listdevice.Count == 0)
+            {
+                return true;
+            }
+
+            List<int> listMomentStatus = new List<int>();
+            List<int> listTriggerStatus = new List<int>();
+            foreach (var device in listdevice)
+            {
+                int MomentStatus = 1;
+                int TriggerZoneStatus = 3;
+                //鑾峰彇瀹夐槻浼犳劅鍣ㄧ殑鐬棿鐘舵�佽瀹氬��
+                this.GetSafeguardSensorMomentStatus(device, ref MomentStatus, ref TriggerZoneStatus);
+
+                listMomentStatus.Add(MomentStatus);
+                listTriggerStatus.Add(TriggerZoneStatus);
+            }
+
+            //娣诲姞璁惧鍒扮綉鍏�
+            List<string> listSuccess = await this.AddSensorDeviceToGateway(zoonId, listdevice, listMomentStatus, listTriggerStatus);
+            if (listSuccess == null)
+            {
+                return false;
+            }
+
+            //淇敼缂撳瓨
+            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
+            {
+                this.dicAllZoneInfo[zoonId] = new SafeguardZoneInfo();
+            }
+
+            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
+            for (int i = 0; i < listdevice.Count; i++)
+            {
+                CommonDevice device = listdevice[i];
+                string mainkey = this.GetDeviceMainKeys(device);
+                if (listSuccess.Contains(mainkey) == false)
+                {
+                    //娌℃湁娣诲姞鎴愬姛
+                    continue;
+                }
+
+                Safeguard.ZoneDeviceListData sensorInfo = null;
+                if (info.dicSensor.ContainsKey(mainkey) == true)
+                {
+                    sensorInfo = info.dicSensor[mainkey];
+                }
+                else
+                {
+                    sensorInfo = new Safeguard.ZoneDeviceListData();
+                    info.dicSensor[mainkey] = sensorInfo;
+                    sensorInfo.Epoint = device.DeviceEpoint;
+                    sensorInfo.MacAddr = device.DeviceAddr;
+                    sensorInfo.IsBypass = 0;
+                }
+                info.dicAllDevice[mainkey] = device.FilePath;
+                //璁惧淇℃伅
+                sensorInfo.MomentStatus = listMomentStatus[0];
+                sensorInfo.TriggerZoneStatus = listTriggerStatus[0];
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 娣诲姞浼犳劅鍣ㄨ澶囧埌缃戝叧(澶辫触鏃朵細寮瑰嚭淇℃伅妗�)
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <param name="listdevice">璁惧鍒楄〃</param>
+        /// <param name="listMomentStatus">璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵��</param>
+        /// <param name="listTriggerStatus">鎴戜篃涓嶇煡閬撹繖涓槸浠�涔堜笢瑗�</param>
+        /// <returns></returns>
+        private async Task<List<string>> AddSensorDeviceToGateway(int zoonId, List<CommonDevice> listdevice, List<int> listMomentStatus, List<int> listTriggerStatus)
+        {
+            var addData = new Safeguard.AddDeviceToZoneData();
+            addData.ZoneId = zoonId;
+            addData.LoginToken = this.GetLoginToken();
+
+            for (int i = 0; i < listdevice.Count; i++)
+            {
+                CommonDevice device = listdevice[i];
+                //鏁版嵁缁勮
+                var deviceData = new Safeguard.DeviceListObj();
+                deviceData.Epoint = device.DeviceEpoint;
+                deviceData.MacAddr = device.DeviceAddr;
+                deviceData.MomentStatus = listMomentStatus[i];
+                deviceData.TriggerZoneStatus = listTriggerStatus[i];
+                addData.DeviceList.Add(deviceData);
+            }
+
+            //娌℃湁鏁版嵁
+            if (addData.DeviceList.Count == 0)
+            {
+                return new List<string>();
+            }
+            //娣诲姞鍒扮綉鍏�
+            var returnData = await Safeguard.AddDeviceToZoneAsync(addData);
+            if (returnData == null || returnData.addDeviceToPartResponseData == null || returnData.addDeviceToPartResponseData.Result == 1)
+            {
+                //鍚戦槻鍖烘坊鍔犺澶囧け璐�
+                string msg = Language.StringByID(R.MyInternationalizationString.uAddDeviceToZoneFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
+
+                this.ShowErrorMsg(msg);
+                return null;
+            }
+
+            List<string> listSuccess = new List<string>();
+            foreach (var data in returnData.addDeviceToPartResponseData.DeviceList)
+            {
+                //涓�鎵硅澶囬噷闈紝鎴愬姛娣诲姞鐨�
+                if (data.Status == 0)
+                {
+                    listSuccess.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
+                }
+                else if (data.Status == 1)
+                {
+                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
+                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                    //鐩爣璁惧涓嶅瓨鍦�
+                    msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
+                    this.ShowTipMsg(msg);
+                }
+                else if (data.Status == 2)
+                {
+                    var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint);
+                    string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                    //璁惧宸插姞鍏ュ叾瀹冮槻鍖�
+                    msg += Language.StringByID(R.MyInternationalizationString.uDeviceHadAddToTheOtherGarrison);
+                    this.ShowTipMsg(msg);
+                }
+            }
+
+            return listSuccess;
+        }
+
+        /// <summary>
+        /// 鑾峰彇瀹夐槻浼犳劅鍣ㄧ殑鐬棿鐘舵�佽瀹氬��(娣诲姞浼犳劅鍣ㄥ埌瀹夐槻鏃讹紝闇�瑕佽皟鐢ㄦ鏂规硶鏉ュ垵濮嬪寲鍙傛暟)
+        /// </summary>
+        /// <param name="device">璁惧瀵硅薄</param>
+        /// <param name="MomentStatus">璁惧涓婃姤鐨勭姸鎬佹槸鍚︿负鐬棿鐘舵��</param>
+        /// <param name="TriggerZoneStatus">鎴戜篃涓嶇煡閬撹繖涓槸浠�涔堜笢瑗�</param>
+        public void GetSafeguardSensorMomentStatus(CommonDevice device, ref int MomentStatus, ref int TriggerZoneStatus)
+        {
+            //杩愬姩浼犳劅鍣�
+            if (device.IasDeviceType == 13)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //鐑熼浘浼犳劅鍣�
+            else if (device.IasDeviceType == 40)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //姘翠镜浼犳劅鍣�
+            else if (device.IasDeviceType == 42)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //鐕冩皵浼犳劅鍣�
+            else if (device.IasDeviceType == 43)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //绱ф�ユ寜閽�
+            else if (device.IasDeviceType == 44)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //閽ュ寵鎵�
+            else if (device.IasDeviceType == 277)
+            {
+                MomentStatus = 1;
+                TriggerZoneStatus = 3;
+            }
+            //闂ㄧ獥浼犳劅鍣�
+            else if (device.IasDeviceType == 21 || device.IasDeviceType == 22)
+            {
+                MomentStatus = 0;
+                TriggerZoneStatus = 3;
+            }
+            //濡傛灉鏄櫄鎷熻澶囷紝鍒欒繖涓笢瑗挎案鎭掍负0
+            if (device.DriveCode > 0)
+            {
+                MomentStatus = 0;
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒犻櫎璁惧___________________________
+
+        /// <summary>
+        /// 鍒犻櫎浼犳劅鍣ㄨ澶�
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <param name="listdevice">浼犳劅鍣ㄨ澶囧璞�</param>
+        public async Task<bool> DeleteSensorDevice(int zoonId, List<CommonDevice> listdevice)
+        {
+            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode != null)
+            {
+                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶鍒犻櫎璁惧
+                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotDeleteDeviceInGarrisonMode);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+
+            //鏍¢獙瀵嗙爜
+            bool result = await this.ShowSafetyAdminValidatedDialog();
+            if (result == false)
+            {
+                return false;
+            }
+
+            if (listdevice.Count == 0)
+            {
+                return true;
+            }
+
+            //浠庣綉鍏抽偅閲屽垹闄よ澶�
+            List<string> listKeys = await this.DeleteSensorDeviceFromGateway(zoonId, listdevice);
+            if (listKeys == null)
+            {
+                return false;
+            }
+
+            //淇敼缂撳瓨
+            if (this.dicAllZoneInfo.ContainsKey(zoonId) == false)
+            {
+                return true;
+            }
+
+            SafeguardZoneInfo info = this.dicAllZoneInfo[zoonId];
+            foreach (CommonDevice device in listdevice)
+            {
+                string mainkey = this.GetDeviceMainKeys(device);
+                if (info.dicSensor.ContainsKey(mainkey) == true
+                    && listKeys.Contains(mainkey) == true)
+                {
+                    info.dicSensor.Remove(mainkey);
+                    info.dicAllDevice.Remove(mainkey);
+                }
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 浠庣綉鍏抽偅閲屽垹闄や紶鎰熷櫒璁惧
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <param name="listdevice">璁惧瀵硅薄</param>
+        /// <returns></returns>
+        private async Task<List<string>> DeleteSensorDeviceFromGateway(int zoonId, List<CommonDevice> listdevice)
+        {
+            var deteleData = new Safeguard.RemoveEqToZoneData();
+            deteleData.ZoneId = zoonId;
+            deteleData.LoginToken = this.GetLoginToken();
+
+            foreach (CommonDevice device in listdevice)
+            {
+                //缁勮鏁版嵁
+                var removeData = new Safeguard.RemoveDeviceListObj();
+                removeData.MacAddr = device.DeviceAddr;
+                removeData.Epoint = device.DeviceEpoint;
+                deteleData.RemoveDeviceList.Add(removeData);
+            }
+
+            //娌℃湁鏁版嵁
+            if (deteleData.RemoveDeviceList.Count == 0)
+            {
+                return new List<string>();
+            }
+
+            //浠庣綉鍏充腑绉婚櫎
+            var returnData = await Safeguard.RemoveDeviceToZoneAsync(deteleData);
+            if (returnData == null || returnData.removeDeviceToZoneResponseData == null || returnData.removeDeviceToZoneResponseData.Result == 1)
+            {
+                //璁惧鍒犻櫎澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData);
+
+                this.ShowErrorMsg(msg);
+
+                return null;
+            }
+
+            List<string> listKeys = new List<string>();
+            foreach (var data in returnData.removeDeviceToZoneResponseData.RemoveDeviceList)
+            {
+                if (data.Status == 0)
+                {
+                    listKeys.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint));
+                }
+            }
+
+            return listKeys;
+        }
+
+        #endregion
+
+        #region 鈻� 瀛樺湪妫�娴媉__________________________
+
+        /// <summary>
+        /// 鎸囧畾浼犳劅鍣ㄨ澶囨槸鍚﹀瓨鍦ㄤ簬瀹夐槻缃戝叧
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public bool IsSensorDeviceExist(CommonDevice device)
+        {
+            string mainkey = this.GetDeviceMainKeys(device);
+            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
+            {
+                if (info.dicSensor.ContainsKey(mainkey) == true)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 鎸囧畾浼犳劅鍣ㄨ澶囨槸鍚﹀瓨鍦ㄤ簬瀹夐槻缃戝叧
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public bool IsSensorDeviceExist(int ZoneId, CommonDevice device)
+        {
+            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
+            {
+                return false;
+            }
+            string mainkey = this.GetDeviceMainKeys(device);
+            SafeguardZoneInfo info = this.dicAllZoneInfo[ZoneId];
+
+            if (info.dicSensor.ContainsKey(mainkey) == true)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// 鎸囧畾鎶ヨ璁惧鏄惁瀛樺湪浜庡畨闃茬綉鍏�
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public bool IsAlarmDeviceExist(int ZoneId, CommonDevice device)
+        {
+            if (ZoneId < 3)
+            {
+                if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
+                {
+                    return false;
+                }
+                string mainkey = this.GetDeviceMainKeys(device);
+                SafeguardZoneInfo info = this.dicAllZoneInfo[ZoneId];
+
+                if (info.dicAlarmDevice.ContainsKey(mainkey) == true)
+                {
+                    return true;
+                }
+            }
+            else
+            {
+                string mainkey = this.GetDeviceMainKeys(device);
+
+                for (int i = 3; i <= 5; i++)
+                {
+                    if (this.dicAllZoneInfo.ContainsKey(i) == false)
+                    {
+                        continue;
+                    }
+                    SafeguardZoneInfo info = this.dicAllZoneInfo[i];
+
+                    if (info.dicAlarmDevice.ContainsKey(mainkey) == true)
+                    {
+                        return true;
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// 鎸囧畾甯冮槻鏄惁瀛樺湪浜庡畨闃茬綉鍏�
+        /// </summary>
+        /// <param name="zoonId">闃插尯ID(瀹冧技涔庢槸鍞竴涓婚敭)</param>
+        /// <returns></returns>
+        public bool IsZoonExist(int zoonId)
+        {
+            return this.dicAllZoneInfo.ContainsKey(zoonId);
+        }
+
+        /// <summary>
+        /// 鏄惁璁剧疆鏈夊唴閮ㄩ槻鍖�
+        /// </summary>
+        /// <returns></returns>
+        public bool IsHadInternalDefenseArea()
+        {
+            foreach (SafeguardZoneInfo info in this.dicAllZoneInfo.Values)
+            {
+                //瀛樺湪绗洓闃插尯
+                if (info.ZoneId == 4)
+                {
+                    //閲岄潰鏈夋病鏈夎澶�
+                    if (info.dicSensor.Count > 0)
+                    {
+                        return true;
+                    }
+                    //涓嶅啀寰�涓嬪惊鐜�
+                    return false;
+                }
+            }
+            return false;
+        }
+
+        #endregion
+
+        #region 鈻� 瀹夐槻鐧婚檰___________________________
+
+        /// <summary>
+        /// 涓荤敤鎴风櫥闄�  0:瀵嗙爜閿欒  1:姝e父  -1:寮傚父
+        /// </summary>
+        /// <param name="password"></param>
+        /// <param name="showMode"></param>
+        public async Task<int> AdminLogin(string password, ShowErrorMode showMode = ShowErrorMode.YES)
+        {
+            //灏濊瘯鐧婚檰
+            var resultData = await ZigBee.Device.Safeguard.AdminLoginResponAsync(password, this.GetLoginToken());
+            if (resultData == null)
+            {
+                return -1;
+            }
+            if (resultData != null && resultData.Result != 0)
+            {
+                if (showMode == ShowErrorMode.YES)
+                {
+                    //绠$悊鍛樺瘑鐮侀敊璇�
+                    string msg = Language.StringByID(R.MyInternationalizationString.uAdministratorPasswordIsError);
+                    this.ShowErrorMsg(msg);
+                }
+                return 0;
+            }
+
+            return 1;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎸囧畾鐢ㄦ埛鐨勫瘑鐮�,濡傛灉鐢ㄦ埛涓嶅瓨鍦紝鍒欒繑鍥瀗ull(閿欒涓嶄細寮瑰嚭淇℃伅)
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        public async Task<string> GetUserPassword(int userId)
+        {
+            //鍏堣幏鍙栧瘑鐮�
+            var nowPw = await Safeguard.CatUserPasswordAsync(this.GetLoginToken());
+            if (nowPw == null || nowPw.catUserPasswordResponseData == null)
+            {
+                return null;
+            }
+
+            foreach (var pw in nowPw.catUserPasswordResponseData.UserPasswordList)
+            {
+                if (pw.UserId == userId)
+                {
+                    return pw.Password;
+                }
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍏ㄩ儴鐢ㄦ埛鐨勫瘑鐮�(閿欒浼氬脊鍑轰俊鎭�)
+        /// </summary>
+        /// <param name="mode">鏄惁鏄剧ず閿欒</param>
+        /// <returns></returns>
+        public async Task<List<Safeguard.UserPasswordListObj>> GetAllUserPassword(ShowErrorMode mode = ShowErrorMode.YES)
+        {
+            //鍏堣幏鍙栧瘑鐮�
+            var nowPw = await Safeguard.CatUserPasswordAsync(this.GetLoginToken());
+            if (nowPw == null || nowPw.catUserPasswordResponseData == null)
+            {
+                //鑾峰彇瀹夐槻瀵嗙爜澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyPasswordFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, nowPw);
+
+                if (mode == ShowErrorMode.YES)
+                {
+                    this.ShowErrorMsg(msg);
+                }
+
+                return null;
+            }
+            return nowPw.catUserPasswordResponseData.UserPasswordList;
+        }
+
+        /// <summary>
+        /// 淇敼鐢ㄦ埛瀵嗙爜(涓嶅瓨鍦ㄦ椂锛屽垯鏂板缓)
+        /// </summary>
+        /// <param name="userId">鐢ㄦ埛ID</param>
+        /// <param name="password">瀵嗙爜</param>
+        /// <param name="passWordTips">瀵嗙爜鎻愮ず</param>
+        /// <returns></returns>
+        public async Task<bool> ChangedUserPassword(int userId, string password, string passWordTips)
+        {
+            //鍒涘缓鏂扮敤鎴�
+            var result = await Safeguard.SetUserPasswordAsync(userId, password, passWordTips, this.GetLoginToken());
+            if (result == null || result.setUserPasswordResponseData == null)
+            {
+                if (userId != 5)
+                {
+                    //淇敼鐢ㄦ埛瀵嗙爜澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedUserPasswordFail);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+                else
+                {
+                    //淇敼鑳佽揩瀵嗙爜澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePasswordFail);
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+            }
+            if (result.setUserPasswordResponseData.Result == 1)
+            {
+                //鐢ㄦ埛瀵嗙爜鏁板凡婊�(鏈�澶�4涓�)
+                string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordCountIsMax);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            if (result.setUserPasswordResponseData.Result == 2)
+            {
+                //瀵嗙爜闀垮害涓嶆纭�
+                string msg = Language.StringByID(R.MyInternationalizationString.uPasswordLengthIsError);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            if (result.setUserPasswordResponseData.Result == 3)
+            {
+                //鐢ㄦ埛瀵嗙爜閲嶅
+                string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsRepeat);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鏄剧ず鏍¢獙绠$悊鍛樺瘑鐮佺殑绐楀彛
+        /// </summary>
+        /// <returns></returns>
+        public async Task<bool> ShowSafetyAdminValidatedDialog()
+        {
+            //寮忔牱鍙樻洿,涓嶅啀寮瑰嚭杈撳叆绠$悊鍛樺瘑鐮佹,鐩存帴鍙栭粯璁ゅ瘑鐮乤dmin
+            //0:瀵嗙爜閿欒  1:姝e父 - 1:寮傚父
+            var result = await this.AdminLogin("admin", ShowErrorMode.NO);
+            if (result != 1)
+            {
+                //鑾峰彇鎵ц鏉冮檺澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetActionAuthorityFail);
+                this.ShowTipMsg(msg);
+                if (result == 0)
+                {
+                    //閲嶇疆瀵嗙爜
+                    await DoResetAdministratorPsw("admin");
+                }
+            }
+            return result == 1;
+        }
+
+        /// <summary>
+        /// 妫�娴嬫槸鍚﹀凡缁忛厤缃湁鐢ㄦ埛瀵嗙爜(鍐呴儴浼氬脊鍑洪敊璇俊鎭�,-1:寮傚父 0:娌℃湁閰嶇疆 1:宸茬粡閰嶇疆)
+        /// </summary>
+        /// <returns></returns>
+        public async Task<int> CheckHadConfigureUserPsw()
+        {
+            var pswInfo = await this.GetAllUserPassword(ShowErrorMode.NO);
+            if (pswInfo == null)
+            {
+                //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇�
+                string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain);
+                this.ShowTipMsg(msg);
+                return -1;
+            }
+            foreach (var data in pswInfo)
+            {
+                //4涓敤鎴峰瘑鐮�
+                if (data.UserId >= 1 && data.UserId <= 4)
+                {
+                    return 1;
+                }
+            }
+            return 0;
+        }
+
+        /// <summary>
+        /// 娣诲姞瀵嗙爜鐨勫娉�
+        /// </summary>
+        /// <param name="userId">鐢ㄦ埛ID</param>
+        /// <param name="password">缃戝叧璇撮渶瑕佸師鏉ョ殑瀵嗙爜,涔熶笉鐭ラ亾涓轰粈涔�</param>
+        /// <param name="passWordTips">瀵嗙爜澶囨敞</param>
+        /// <returns></returns>
+        public async Task<bool> AddPassWordTips(int userId, string password, string passWordTips)
+        {
+            var result = await Safeguard.SetPassWordTipsAsync(userId, password, passWordTips, this.GetLoginToken());
+            if (result == null || result.setUserPasswordResponseData == null)
+            {
+                //淇敼澶囨敞淇℃伅澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            if (result.setUserPasswordResponseData.Result != 0)
+            {
+                //淇敼澶囨敞淇℃伅澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
+
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 鎶ヨ鐩爣___________________________
+
+        /// <summary>
+        /// 娣诲姞鎶ヨ鐩爣鍒板畨闃�
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <param name="listAction">娣诲姞鐨勭洰鏍�</param>
+        /// <returns></returns>
+        public async Task<bool> AddAlarmTagetToSafety(int ZoneId, List<Safeguard.AlarmActionObj> listAction)
+        {
+            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode != null)
+            {
+                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶娣诲姞璁惧
+                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotAddDeviceInGarrisonMode);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            //楠岃瘉韬唤
+            bool login = await this.ShowSafetyAdminValidatedDialog();
+            if (login == false)
+            {
+                return false;
+            }
+
+            if (ZoneId > 3)
+            {
+                ZoneId = 3;
+            }
+            var saveData = new Safeguard.AddZoneActionData();
+            saveData.ActionType = ZoneId;
+            saveData.Actions = listAction;
+            saveData.LoginToken = this.GetLoginToken();
+
+            //娣诲姞鎶ヨ鐩爣鍒板畨闃�
+            var result = await Safeguard.AddZoneActionAsync(saveData);
+            if (result == null || result.addZoneActionResponseData == null || result.addZoneActionResponseData.Result == 1)
+            {
+                //娣诲姞鎶ヨ鐩爣澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uAddAlarmTargetFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+
+                return false;
+            }
+            foreach (var data in result.addZoneActionResponseData.Actions)
+            {
+                if (data.Status == "1")
+                {
+                    if (data.Type == "0")
+                    {
+                        var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint);
+                        string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n";
+                        //鐩爣璁惧涓嶅瓨鍦�
+                        msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit);
+                        this.ShowTipMsg(msg);
+                    }
+                    else if (data.Type == "1")
+                    {
+                        var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(data.ScenesId);
+                        if (scene != null)
+                        {
+                            string msg = scene.Name + "\r\n";
+                            //鐩爣鍦烘櫙涓嶅瓨鍦�
+                            msg += Language.StringByID(R.MyInternationalizationString.uTargetSceneIsNotExsit);
+                            this.ShowTipMsg(msg);
+                        }
+                    }
+                }
+            }
+
+            //灏嗘姤璀︾洰鏍囧垪琛ㄥ姞鍏ョ紦瀛�(浠庢柊浠庣綉鍏抽偅閲岃幏鍙栨柊杩藉姞鐨勮澶�)
+            var resultData = await Safeguard.CatZoneActionAsync(ZoneId);
+            if (resultData == null
+                || resultData.catZoneActionResponseData == null
+                || resultData.catZoneActionResponseData.Result == 1)
+            {
+                //鑾峰彇鎶ヨ鐩爣鍒楄〃澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetAlarmTargetListFail);
+                this.ShowTipMsg(msg);
+                return false;
+            }
+            this.SetAlarmTargetDeviceToMemory(resultData.catZoneActionResponseData, ShowErrorMode.YES);
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鎶ヨ鐩爣
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <param name="listActions">鍒犻櫎鐨勭洰鏍�</param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAlarmTaget(int ZoneId, List<Safeguard.DelAlarmActionObj> listActions)
+        {
+            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode != null)
+            {
+                //褰撳墠姝e浜庡竷闃叉ā寮�,鏃犳硶鍒犻櫎璁惧
+                string msg = Language.StringByID(R.MyInternationalizationString.uCanNotDeleteDeviceInGarrisonMode);
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            //楠岃瘉韬唤
+            bool login = await this.ShowSafetyAdminValidatedDialog();
+            if (login == false)
+            {
+                return false;
+            }
+            if (ZoneId > 3)
+            {
+                ZoneId = 3;
+            }
+            //鍙傛暟
+            var Pra = new Safeguard.DelZoneActionData();
+            Pra.ActionType = ZoneId;
+            Pra.Actions = listActions;
+            Pra.LoginToken = this.GetLoginToken();
+            //鎵ц鍒犻櫎
+            var result = await Safeguard.DelZoneActionAsync(Pra);
+            if (result == null || result.delZoneActionResponseData == null || result.delZoneActionResponseData.Result == 1)
+            {
+                //鍒犻櫎鎶ヨ鐩爣澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteAlarmTargetFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+
+                return false;
+            }
+
+            //鑾峰彇鏈湴缂撳瓨
+            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
+            {
+                return true;
+            }
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[ZoneId];
+
+            //淇敼缂撳瓨
+            foreach (var device in result.delZoneActionResponseData.Actions)
+            {
+                //鍒犻櫎澶辫触
+                if (device.Status == "1")
+                {
+                    continue;
+                }
+                //璁惧
+                if (device.Type == "0")
+                {
+                    //鍒犻櫎鎶ヨ璁惧
+                    string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint);
+                    if (zoneInfo.dicAlarmDevice.ContainsKey(mainkeys) == false)
+                    {
+                        continue;
+                    }
+                    zoneInfo.dicAlarmDevice.Remove(mainkeys);
+                    zoneInfo.dicAllDevice.Remove(mainkeys);
+                }
+                //鍦烘櫙
+                else if (device.Type == "1")
+                {
+                    //鍒犻櫎鍦烘櫙
+                    if (zoneInfo.dicScenes.ContainsKey(device.ScenesId) == true)
+                    {
+                        zoneInfo.dicScenes.Remove(device.ScenesId);
+                    }
+                }
+            }
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 鑾峰彇鍦烘櫙___________________________
+
+        /// <summary>
+        /// 鏍规嵁闃插尯ID鑾峰彇鏈湴鐨勫満鏅�
+        /// </summary>
+        /// <param name="ZoneId">闃插尯ID</param>
+        /// <returns></returns>
+        public Dictionary<int, string> GetLocalSceneByZoneID(int ZoneId)
+        {
+            if (ZoneId > 3)
+            {
+                ZoneId = 3;
+            }
+            if (this.dicAllZoneInfo.ContainsKey(ZoneId) == false)
+            {
+                return new Dictionary<int, string>();
+            }
+            var infoData = this.dicAllZoneInfo[ZoneId];
+            return infoData.dicScenes;
+        }
+
+        #endregion
+
+        #region 鈻� 鏃佽矾璁剧疆___________________________
+
+        /// <summary>
+        /// 鏃佽矾鐘舵�佽缃�
+        /// </summary>
+        /// <param name="zoneId">闃插尯ID</param>
+        /// <param name="device">浼犳劅鍣ㄨ澶�</param>
+        /// <param name="statu">鏃佽矾鐘舵�� -> 0:涓嶆梺璺�  1:鏃佽矾</param>
+        /// <returns></returns>
+        public async Task<bool> SetByPassStatuToSafety(int zoneId, CommonDevice device, int statu)
+        {
+            //楠岃瘉
+            bool flage = await this.ShowSafetyAdminValidatedDialog();
+            if (flage == false)
+            {
+                return false;
+            }
+
+            //鍙傛暟
+            var Pra = new Safeguard.EqByPassData();
+            Pra.ZoneId = zoneId;
+            Pra.MacAddr = device.DeviceAddr;
+            Pra.Epoint = device.DeviceEpoint;
+            Pra.IsByPass = statu;
+            Pra.LoginToken = this.GetLoginToken();
+
+            var result = await Safeguard.EqByPassAllDataAsync(Pra);
+            if (result == null || result.eqByPassResponseData != null && result.eqByPassResponseData.Result == 3)
+            {
+                //璁剧疆澶辫触,绯荤粺褰撳墠澶勪簬鎾ら槻鐘舵��
+                string msg2 = Language.StringByID(R.MyInternationalizationString.uByPassFailAndSystemInWithdrawGarrisonStatu);
+                this.ShowErrorMsg(msg2);
+                return false;
+            }
+
+            //鍏朵粬閿欒
+            if (result.eqByPassResponseData == null || result.eqByPassResponseData.Result != 0)
+            {
+                //鏃佽矾鐘舵�佽缃け璐�
+                string msg = Language.StringByID(R.MyInternationalizationString.uSetByPassStatuFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+
+                return false;
+            }
+
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 甯冮槻鎾ら槻___________________________
+
+        /// <summary>
+        /// 璁剧疆瀹夐槻鐨勫竷闃叉ā寮�,鎴愬姛鏃�,鍐呴儴涓嶄細鎻愮ず淇℃伅(涓嶈璋冪敤姝ゆ柟娉曟潵瀹炵幇銆愭挙闃层��)
+        /// </summary>
+        /// <param name="garrison">甯冮槻妯″紡</param>
+        /// <returns>缃戝叧鐜板湪瀹炶鐨勫竷闃叉ā寮�</returns>
+        public async Task<GarrisonMode> SetSafetyGarrisonByModel(GarrisonMode garrison)
+        {
+            //妫�娴嬪叾浠栭槻鍖洪噷闈㈡湁娌℃湁閰嶇疆鏈変紶鎰熷櫒
+            if (this.CheckHadInteriorSectorsSensor() == false)
+            {
+                //鍏朵粬闃插尯閲屾病鏈夐厤缃紶鎰熷櫒璁惧
+                string msg = Language.StringByID(R.MyInternationalizationString.uNotSensorInOtherSectors);
+                this.ShowErrorMsg(msg);
+                return GarrisonMode.None;
+            }
+
+            if (this.UserPassword == null)
+            {
+                var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword);
+                if (data != null)
+                {
+                    this.UserPassword = System.Text.Encoding.UTF8.GetString(data);
+                }
+            }
+            if (string.IsNullOrEmpty(this.UserPassword) == true)
+            {
+                //杈撳叆瀵嗙爜
+                string password = await this.ShowInputUserPasswordForm();
+                if (string.IsNullOrEmpty(password) == true)
+                {
+                    return GarrisonMode.None;
+                }
+                var result = await this.SetSafetyGarrisonByModel(garrison, false);
+                if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison)
+                {
+                    //淇濆瓨鍔犲瘑鐨勫瘑鐮佸埌鏈湴
+                    HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                }
+                return result;
+            }
+            else
+            {
+                return await this.SetSafetyGarrisonByModel(garrison, true);
+            }
+        }
+
+        /// <summary>
+        /// 璁剧疆瀹夐槻鐨勫竷闃叉ā寮�,鎴愬姛鏃�,鍐呴儴涓嶄細鎻愮ず淇℃伅(涓嶈璋冪敤姝ゆ柟娉曟潵瀹炵幇銆愭挙闃层��)
+        /// </summary>
+        /// <param name="garrison">甯冮槻妯″紡</param>
+        /// <param name="showPswForm">鐢ㄦ埛瀵嗙爜閿欒鏃讹紝鏄惁鍏佽寮瑰嚭杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�</param>
+        /// <returns>缃戝叧鐜板湪瀹炶鐨勫竷闃叉ā寮�</returns>
+        private async Task<GarrisonMode> SetSafetyGarrisonByModel(GarrisonMode garrison, bool showPswForm)
+        {
+            //鍏堟妸褰撳墠鐨勬ā寮忕粰绉婚櫎鎺�
+            var flage = await this.RemoveSafetyGarrison(garrison, showPswForm);
+            if (flage == -1)
+            {
+                return GarrisonMode.None;
+            }
+            //鍒ゆ柇鏈夋病鏈夊叾浠栭�昏緫鍘讳慨鏀逛簡甯冮槻妯″紡
+            //鎵�浠ュ啀娆¤幏鍙栨ā寮�
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode != null)
+            {
+                return GarrisonMode.None;
+            }
+
+            //鍙傛暟 
+            var Pra = new Safeguard.EnableModeData();
+            //妯″紡ID
+            Pra.ModeId = (int)garrison;
+            //妫�鏌ラ槻鍖鸿澶囨渶杩戜笂鎶ョ殑瀹夐槻淇℃伅鐘舵�佽繘琛屽竷闃�
+            Pra.CheckIASStatus = 1;
+            //姘镐箙甯冮槻锛岀洿鍒版挙闃�
+            Pra.Setting = 1;
+            //鐢ㄦ埛瀵嗙爜
+            Pra.UserPassword = this.UserPassword;
+
+            //鎵ц甯冮槻
+            var result = await Safeguard.EnableModeAsync(Pra);
+            if (result == null || result.enableModeResponseData == null)
+            {
+                //甯冮槻璁剧疆澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return GarrisonMode.RemoveGarrison;
+            }
+
+            //閿欒妫�娴�
+            if (result.enableModeResponseData.Result == 1)
+            {
+                //甯冮槻妯″紡涓嶅瓨鍦�
+                string msg = Language.StringByID(R.MyInternationalizationString.uGarrisonModeIsNotEsixt);
+                this.ShowErrorMsg(msg);
+                return GarrisonMode.RemoveGarrison;
+            }
+            else if (result.enableModeResponseData.Result == 2)
+            {
+                //娓呯┖瀵嗙爜缂撳瓨
+                this.UserPassword = null;
+
+                if (showPswForm == false)
+                {
+                    //鐢ㄦ埛瀵嗙爜閿欒鎴栨湭璁剧疆鐢ㄦ埛瀵嗙爜
+                    string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsError);
+                    this.ShowErrorMsg(msg);
+                    return GarrisonMode.RemoveGarrison;
+                }
+                else
+                {
+                    //閲嶆柊鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�
+                    string password = await this.ShowInputUserPasswordForm();
+                    if (string.IsNullOrEmpty(password) == true)
+                    {
+                        return GarrisonMode.RemoveGarrison;
+                    }
+
+                    var result2 = await this.SetSafetyGarrisonByModel(garrison, false);
+                    if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison)
+                    {
+                        //淇濆瓨鍔犲瘑瀵嗙爜鍒版湰鍦�
+                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                    }
+                    return result2;
+                }
+            }
+            else if (result.enableModeResponseData.Result == 3)
+            {
+                //瀹夐槻璁惧鏈氨缁�
+                string msg = Language.StringByID(R.MyInternationalizationString.uSafetyDeviceDoNotReady);
+                msg += "(" + result.enableModeResponseData.IASName + ")";
+                this.ShowErrorMsg(msg);
+                return GarrisonMode.RemoveGarrison;
+            }
+            else if (result.enableModeResponseData.Result == 4)
+            {
+                //鍏朵粬甯冮槻妯″紡姝e湪鍚敤涓�
+                string msg = Language.StringByID(R.MyInternationalizationString.uOtherGarrisonIsActtion);
+                this.ShowErrorMsg(msg);
+                return (GarrisonMode)result.enableModeResponseData.ModeIdBeUsing;
+            }
+            else if (result.enableModeResponseData.Result == 5)
+            {
+                //妯″紡灞炴�т笉鍏佽澶辫兘
+                string msg = Language.StringByID(R.MyInternationalizationString.uGarrisonModeElementCanNotLostFunction);
+                this.ShowErrorMsg(msg);
+                return GarrisonMode.RemoveGarrison;
+            }
+            return garrison;
+        }
+
+        /// <summary>
+        /// 绉婚櫎褰撳墠姝e湪杩愯鐨勫竷闃叉ā寮�(鎴愬姛鏃讹紝鍐呴儴涓嶄細鎻愮ず淇℃伅)
+        /// </summary>
+        /// <param name="garrison">甯冮槻妯″紡(杩欎釜鍙橀噺鍙槸涓轰簡鍙樻洿鎻愮ず閿欒淇℃伅锛屽綋涓嶆槸鎾ら槻鏃讹紝閿欒鎻愮ず淇℃伅浼氭敼鍙�)</param>
+        /// <param name="showPswForm">鐢ㄦ埛瀵嗙爜閿欒鏃讹紝鏄惁鍏佽寮瑰嚭杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�</param>
+        /// <returns></returns>
+        public async Task<int> RemoveSafetyGarrison(GarrisonMode garrison, bool showPswForm)
+        {
+            //鐜拌幏鍙栧綋鍓嶇殑甯冮槻妯″紡
+            var safetyMode = await this.GetSafetyMode();
+            if (safetyMode == null)
+            {
+                //濡傛灉鏄挙闃茬殑璇�
+                if (garrison == GarrisonMode.RemoveGarrison)
+                {
+                    //褰撳墠涓嶅瓨鍦ㄥ竷闃�
+                    string msg = Language.StringByID(R.MyInternationalizationString.uNowDoNotHadGarrison);
+                    this.ShowErrorMsg(msg);
+                    return -1;
+                }
+                //骞舵病鏈夎缃竷闃�,涔熷氨涓嶈皥浠�涔堟挙闃蹭簡
+                return 0;
+            }
+
+            //鎾ら槻鐨勬椂鍊欙紝鏃犳潯浠跺脊鍑鸿緭鍏ュ瘑鐮佹
+            if (garrison == GarrisonMode.RemoveGarrison)
+            {
+                string psw = await this.ShowInputUserPasswordForm();
+                if (string.IsNullOrEmpty(psw) == true)
+                {
+                    return -1;
+                }
+            }
+
+            //鎾ら槻
+            var result = await Safeguard.WithdrawModeAsync(this.UserPassword);
+            if (result == null || result.withdrawModeResponseData == null)
+            {
+                //鎵ц鎾ら槻鎿嶄綔鐨勬椂鍊�
+                if (garrison == GarrisonMode.RemoveGarrison)
+                {
+                    //鎾ら槻澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                    this.ShowErrorMsg(msg);
+                }
+                else
+                {
+                    //甯冮槻妯″紡鍙樻洿澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedGarrisonModeFail);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                    this.ShowErrorMsg(msg);
+                }
+
+                return -1;
+            }
+
+            if (result.withdrawModeResponseData.Result == 2)
+            {
+                //娓呯┖瀵嗙爜缂撳瓨
+                this.UserPassword = null;
+                if (showPswForm == false || garrison == GarrisonMode.RemoveGarrison)
+                {
+                    //鐢ㄦ埛瀵嗙爜閿欒鎴栨湭璁剧疆鐢ㄦ埛瀵嗙爜
+                    string msg = Language.StringByID(R.MyInternationalizationString.uUserPasswordIsError);
+                    this.ShowErrorMsg(msg);
+                    return -1;
+                }
+                else
+                {
+                    //閲嶆柊鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭獥鍙�
+                    string password = await this.ShowInputUserPasswordForm();
+                    if (string.IsNullOrEmpty(password) == true)
+                    {
+                        return -1;
+                    }
+
+                    var result2 = await this.RemoveSafetyGarrison(garrison, false);
+                    if (result2 != -1)
+                    {
+                        //淇濆瓨鍒板姞瀵嗗瘑鐮佹湰鍦�
+                        HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
+                    }
+                    return result2;
+                }
+            }
+            else if (result.withdrawModeResponseData.Result == 3 && garrison == GarrisonMode.RemoveGarrison)
+            {
+                //褰撳墠妯″紡涓嶅彲鎾ら槻
+                string msg = Language.StringByID(R.MyInternationalizationString.uNowGarrisonCanNotRemove);
+                this.ShowErrorMsg(msg);
+                return -1;
+            }
+            return 1;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠瀹夐槻鐨勬ā寮�(鍦ㄥ锛岀瀹剁瓑绛�),濡傛灉娌℃湁甯冮槻锛屽垯杩斿洖null
+        /// </summary>
+        public async Task<Safeguard.GetModeUsingResponseData> GetSafetyMode()
+        {
+            var result = await Safeguard.GetModeUsingAsync();
+            if (result == null || result.getModeUsingResponseData == null)
+            {
+                return null;
+            }
+            if (result.getModeUsingResponseData.Result == 1)
+            {
+                return null;
+            }
+            return result.getModeUsingResponseData;
+        }
+
+        /// <summary>
+        /// 鏄剧ず杈撳叆鐢ㄦ埛瀵嗙爜鐨勭晫闈�(杩斿洖null鏃朵唬琛ㄥ嚭閿欐垨鑰呭彇娑�)
+        /// </summary>
+        public async Task<string> ShowInputUserPasswordForm()
+        {
+            NumberPswInputDialogForm Dialogform = null;
+
+            bool isShowingProgressBar = false;
+            string ProgressBarText = string.Empty;
+
+            string pasword = null;
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                isShowingProgressBar = CommonPage.Loading.Visible;
+                ProgressBarText = CommonPage.Loading.Text;
+                if (isShowingProgressBar == true)
+                {
+                    //濡傛灉鍦ㄥ脊鍑烘牎楠屽瘑鐮佹鐨勬椂鍊欙紝鏄剧ず鐫�杩涘害鏉$殑璇濓紝鍏堟殏鏃跺叧闂繘搴︽潯
+                    CommonPage.Loading.Hide();
+                }
+
+                Dialogform = new NumberPswInputDialogForm();
+                Dialogform.AddForm(Language.StringByID(R.MyInternationalizationString.uPleaseInputUserPassword), 4);
+                //纭鎸夐挳
+                Dialogform.FinishInputEvent += ((textValue) =>
+                {
+                    Dialogform.CloseForm();
+                    //鐢ㄦ埛瀵嗙爜
+                    pasword = textValue;
+                    //鍔犲瘑瀵嗙爜
+                    this.UserPassword = pasword;
+                });
+            });
+            while (pasword == null)
+            {
+                if (Dialogform != null && Dialogform.Parent == null)
+                {
+                    break;
+                }
+                await Task.Delay(500);
+            }
+
+            //鎭㈠杩涘害鏉�
+            if (isShowingProgressBar == true)
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    CommonPage.Loading.Start(ProgressBarText);
+                });
+            }
+            return pasword;
+        }
+
+        /// <summary>
+        /// 妫�娴嬪叾浠栭槻鍖洪噷闈㈡湁娌℃湁閰嶇疆鏈変紶鎰熷櫒(甯冮槻浣跨敤)
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckHadInteriorSectorsSensor()
+        {
+            for (int i = 3; i <= 5; i++)
+            {
+                if (dicAllZoneInfo.ContainsKey(i) == true
+                    && dicAllZoneInfo[i].dicSensor.Count > 0)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        #endregion
+
+        #region 鈻� 淇℃伅鎺ㄩ�乢__________________________
+
+        /// <summary>
+        /// 璁剧疆鎸囧畾闃插尯鐨勪俊鎭帹閫佺姸鎬�
+        /// </summary>
+        /// <param name="zoneId">闃插尯ID</param>
+        /// <param name="statu">鐘舵��  0:鎺ㄩ��  1:涓嶆帹閫�</param>
+        /// <returns></returns>
+        public async Task<bool> SetGarrisonInformationPushStatu(int zoneId, int statu)
+        {
+            //鏍¢獙瀵嗙爜
+            bool flage = await this.ShowSafetyAdminValidatedDialog();
+            if (flage == false)
+            {
+                return false;
+            }
+            //鐘舵�佸彉鏇�
+            var result = await Safeguard.DisablePushMessageAsync(zoneId, statu);
+            if (result == null || result.disablePushMessageResponseData == null || result.disablePushMessageResponseData.Result == 1)
+            {
+                //璁剧疆淇℃伅鎺ㄩ�佸け璐�
+                string msg = Language.StringByID(R.MyInternationalizationString.uSetInformationPushFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
+            {
+                return true;
+            }
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[zoneId];
+            zoneInfo.InformationPush = statu;
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠闃插尯鐨勪俊鎭帹閫佺姸鎬�
+        /// </summary>
+        /// <param name="zoneId">闃插尯ID</param>
+        /// <returns>0:鎺ㄩ��  1:涓嶆帹閫�</returns>
+        public int GetGarrisonInformationPushStatu(int zoneId)
+        {
+            if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
+            {
+                return 1;
+            }
+            SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[zoneId];
+            return zoneInfo.InformationPush;
+        }
+
+        #endregion
+
+        #region 鈻� 寤惰繜璁剧疆___________________________
+
+        /// <summary>
+        /// 鑾峰彇闃插尯鐨勫欢杩熸椂闂�(浠呴檺鍑哄叆闃插尯),鍑洪敊鏃惰繑鍥瀗ull
+        /// </summary>
+        /// <returns></returns>
+        public async Task<Safeguard.CatDelayTimeResponseData> GetGarrisonDelayTime()
+        {
+            //鑾峰彇
+            var result = await Safeguard.CatDelayTimeAsync();
+            if (result == null || result.catDelayTimeResponseData == null)
+            {
+                //鑾峰彇寤舵椂鏃堕棿澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetDelayTimeFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return null;
+            }
+            return result.catDelayTimeResponseData;
+        }
+
+        /// <summary>
+        /// 璁剧疆闃插尯鐨勮繘鍑哄欢杩熸椂闂� (浠呴檺鍑哄叆闃插尯),鐜版帴鍙d笉鏀寔鍗曚釜淇敼
+        /// </summary>
+        /// <param name="enterDelayTime">杩涘叆寤舵椂(绉�)</param>
+        /// <param name="goOutDelayTime">澶栧嚭寤舵椂(绉�)</param>
+        /// <returns></returns>
+        public async Task<bool> SetGarrisonDelayTime(int enterDelayTime, int goOutDelayTime)
+        {
+            //鏍¢獙瀵嗙爜
+            bool flage = await this.ShowSafetyAdminValidatedDialog();
+            if (flage == false)
+            {
+                return false;
+            }
+            //鏇存敼鏃堕棿
+            var result = await Safeguard.SetDelayTimeAsync(enterDelayTime, goOutDelayTime, this.GetLoginToken());
+            if (result == null || result.setDelayTimeResponseData == null)
+            {
+                //璁剧疆寤舵椂鏃堕棿澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uSetDelayTimeFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 鑳佽揩璁剧疆___________________________
+
+        /// <summary>
+        /// 鑾峰彇鑳佽揩鐨勭數璇濊仈绯绘柟寮�(鑾峰彇澶辫触鏃朵細杩斿洖null)
+        /// </summary>
+        /// <returns></returns>
+        public async Task<Safeguard.CheckCoercePhoneNumberResponseData> GetCoercePhoneNumber()
+        {
+            //鑾峰彇
+            var result = await Safeguard.CheckCoercePhoneNumberAsync();
+            if (result == null || result.checkCoercePhoneNumberResponseData == null)
+            {
+                //鑾峰彇鑳佽揩鑱旂郴鏂瑰紡淇℃伅澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uGetCoercePhoneNumberFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return null;
+            }
+            //娌℃湁鏁版嵁
+            if (result.checkCoercePhoneNumberResponseData.Result == 1)
+            {
+                return null;
+            }
+            return result.checkCoercePhoneNumberResponseData;
+        }
+
+        /// <summary>
+        /// 璁剧疆鑳佽揩鐨勮仈绯讳汉鏂瑰紡
+        /// </summary>
+        /// <param name="listPhone">鍦板尯鐮�-鑱旂郴鏂瑰紡</param>
+        /// <param name="listNote">鑱旂郴浜哄娉�</param>
+        /// <param name="addPhone">鏄惁鏄柊寤鸿仈绯讳汉,false鐨勬椂鍊�,鍙敼澶囨敞</param>
+        /// <returns></returns>
+        public async Task<bool> SetCoercePhoneNumber(List<string> listPhone, List<string> listNote, bool addPhone = true)
+        {
+            if (addPhone == true)
+            {
+                var Pra = new Safeguard.SetCoercePhoneNumberData();
+                var Actonobj = new Safeguard.PushTargetActionObj();
+                Actonobj.Type = 2;
+                Pra.Actions.Add(Actonobj);
+                Pra.LoginToken = this.GetLoginToken();
+
+                for (int i = 0; i < listPhone.Count; i++)
+                {
+                    var phoneInfo = new Safeguard.PushTargetInfo();
+                    Actonobj.PushTarget.Add(phoneInfo);
+                    //鐢佃瘽鍙风爜
+                    phoneInfo.PushNumber = listPhone[i];
+                }
+                var result = await Safeguard.SetCoercePhoneNumberAsync(Pra);
+                if (result == null || result.setCoercePhoneNumberResponseData == null || result.setCoercePhoneNumberResponseData.Result != 0)
+                {
+                    //淇敼鑳佽揩鑱旂郴鏂瑰紡澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePhoneNumberFail);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+            }
+            for (int i = 0; i < listNote.Count; i++)
+            {
+                var result = await Safeguard.SetCoercePhoneNumberNoteAsync(listPhone[i], listNote[i]);
+                if (result == null)
+                {
+                    //淇敼澶囨敞淇℃伅澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
+                    //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                    msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+                if (result.Result == -2)
+                {
+                    //閿欒:缃戝叧瀵硅薄涓㈠け
+                    string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+                if (result.Result != 0)
+                {
+                    //淇敼澶囨敞淇℃伅澶辫触
+                    string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail);
+                    this.ShowErrorMsg(msg);
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鑳佽揩鐨勮仈绯讳汉鏂瑰紡
+        /// </summary>
+        /// <param name="areaCode"></param>
+        /// <param name="phoneNum"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteCoercePhoneNumber(string areaCode, string phoneNum)
+        {
+            var Pra = new Safeguard.DelCoercePhoneNumberData();
+            var Actonobj = new Safeguard.PushTargetActionObj();
+            Actonobj.Type = 2;
+            Pra.Actions.Add(Actonobj);
+            Pra.LoginToken = this.GetLoginToken();
+
+            var phoneInfo = new Safeguard.PushTargetInfo();
+            Actonobj.PushTarget.Add(phoneInfo);
+            //鐢佃瘽鍙风爜
+            phoneInfo.PushNumber = areaCode + "-" + phoneNum;
+
+            var result = await Safeguard.DelCoercePhoneNumberAsync(Pra);
+            if (result == null || result.delCoercePhoneNumberResponseData == null || result.delCoercePhoneNumberResponseData.Result != 0)
+            {
+                //鍒犻櫎鑳佽揩鑱旂郴鏂瑰紡澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCoercePhoneNumberFail);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowErrorMsg(msg);
+                return false;
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 缁欒仈绯诲彿鐮佹坊鍔犲娉ㄧ殑淇℃伅
+        /// </summary>
+        private class AddPushNumberNoteInfo
+        {
+            /// <summary>
+            /// 鍥哄畾253
+            /// </summary>
+            public int ActionType = 253;
+            /// <summary>
+            /// LoginToken
+            /// </summary>
+            public string LoginToken = string.Empty;
+            /// <summary>
+            /// 鍦板尯鐮�-鑱旂郴鏂瑰紡
+            /// </summary>
+            public string PushNumber = string.Empty;
+            /// <summary>
+            /// 鑱旂郴浜哄彿鐮佸娉紝鏈�澶�63byte
+            /// </summary>
+            public string PushNumberNote = string.Empty;
+        }
+
+        #endregion
+
+        #region 鈻� 鎵ц鐩爣鐘舵�佺殑缈昏瘧鏂囨湰_____________
+
+        /// <summary>
+        /// 鑾峰彇鎵ц鐩爣鐨勭姸鎬佹枃鏈�
+        /// </summary>
+        /// <param name="listTaskInfo">鍔ㄤ綔瀵硅薄,鍙互涓虹┖</param>
+        /// <returns></returns>
+        public string GetAdjustTargetStatuText(List<Safeguard.TaskListInfo> listTaskInfo)
+        {
+            if (listTaskInfo == null || listTaskInfo.Count == 0)
+            {
+                //鏃犲姩浣�
+                return Language.StringByID(R.MyInternationalizationString.uNotAction);
+            }
+            //瑕佽�冭檻瀹冪殑鎺掑垪椤哄簭(鍙互鎸夐渶姹傚彉鏇寸紪鍙�)
+            Dictionary<int, string> dicSort = new Dictionary<int, string>();
+            //鏈�澶х紪鍙�
+            int MaxNo = listTaskInfo.Count > 4 ? listTaskInfo.Count : 4;
+            //寮�鍏崇殑浣嶇疆缂栧彿
+            int ControlNo = 0;
+            //鐧惧垎姣旂殑浣嶇疆缂栧彿
+            int persentNo = 1;
+            //绌鸿皟娓╁害鐨勪綅缃紪鍙�
+            int temparetureNo = 2;
+            //绌鸿皟妯″紡鐨勪綅缃紪鍙�
+            int modelNo = 3;
+            //绌鸿皟椋庨�熺殑浣嶇疆缂栧彿
+            int windNo = 4;
+            //鍏朵粬缂栧彿(涓嶇悊浼氫綅缃�,浠ュ垪琛ㄧ殑椤哄簭涓哄噯)
+            int otherNo = 100;
+
+            foreach (var info in listTaskInfo)
+            {
+                #region 鈻� 鏅捐。鏋禵_____
+                //鈽呪槄鈽呪槄涓存椂澶勭悊,鍚庢湡浼氬垹闄�
+                if (info.Epoint != -1)
+                {
+                    //鏈�楂樻渶浣庡
+                    if (info.Epoint == 1)
+                    {
+                        dicSort[dicSort.Count + otherNo] = info.Data1 == 0 ? Language.StringByID(R.MyInternationalizationString.uTheHighestPoint) : Language.StringByID(R.MyInternationalizationString.uTheLowestPoint);
+                    }
+                    //椋庡共
+                    else if (info.Epoint == 3)
+                    {
+                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenAirdry) : Language.StringByID(R.MyInternationalizationString.uCloseAirdry);
+                    }
+                    //鐑樺共
+                    else if (info.Epoint == 4)
+                    {
+                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDry) : Language.StringByID(R.MyInternationalizationString.uCloseDry);
+                    }
+                    //娑堟瘨
+                    else if (info.Epoint == 5)
+                    {
+                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDisinfect) : Language.StringByID(R.MyInternationalizationString.uCloseDisinfect);
+                    }
+                    //鐓ф槑
+                    else if (info.Epoint == 2)
+                    {
+                        dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenLighting) : Language.StringByID(R.MyInternationalizationString.uCloseLighting);
+                    }
+                    //鐗规畩,涓嶈兘寰�涓嬭蛋
+                    continue;
+                }
+                #endregion
+
+                #region 鈻� 寮�鍏虫帶鍒禵___
+                //寮�鍏虫帶鍒�
+                if (info.TaskType == 1)
+                {
+                    if (info.Data1 == 1)
+                    {
+                        //寮�
+                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleOpen);
+                    }
+                    else
+                    {
+                        //鍏�
+                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
+                    }
+                }
+                #endregion
+
+                #region 鈻� 浜害璋冭妭____
+                //浜害璋冭妭
+                else if (info.TaskType == 3)
+                {
+                    if (info.Data1 == 0)
+                    {
+                        //鍏�
+                        dicSort[persentNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
+                    }
+                    else
+                    {
+                        dicSort[persentNo] = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(info.Data1) + "%";
+                    }
+                }
+                #endregion
+
+                #region 鈻� 绐楀笜璁惧____
+                //绐楀笜璁惧(瀹冪殑寮�鍏冲拰寮�鍏虫帶鍒舵槸鍙嶈繃鏉ョ殑)
+                else if (info.TaskType == 6)
+                {
+                    if (info.Data1 == 0)
+                    {
+                        //寮�
+                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleOpen);
+                    }
+                    else if (info.Data1 == 1)
+                    {
+                        //鍏�
+                        dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
+                    }
+                    else if (info.Data1 == 5)
+                    {
+                        //绐楀笜鐧惧垎姣�
+                        dicSort[persentNo] = info.Data2 + "%";
+                    }
+                }
+                #endregion
+
+                #region 鈻� 绌鸿皟璁惧____
+                //绌鸿皟璁惧
+                else if (info.TaskType == 5)
+                {
+                    if (info.Data1 == 3)
+                    {
+                        if (info.Data2 == 0)
+                        {
+                            return Language.StringByID(R.MyInternationalizationString.uSimpleClose);
+                        }
+                        else if (info.Data2 == 1)
+                        {
+                            //鑷姩
+                            dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Auto);
+                        }
+                        else if (info.Data2 == 3)
+                        {
+                            //鍒跺喎
+                            dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Cool);
+                        }
+                        else if (info.Data2 == 4)
+                        {
+                            //鍒剁儹
+                            dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Heat);
+                        }
+                        else if (info.Data2 == 7)
+                        {
+                            //閫侀
+                            dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly);
+                        }
+                        else if (info.Data2 == 8)
+                        {
+                            //闄ゆ箍
+                            dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Dry);
+                        }
+                    }
+                    else if (info.Data1 == 4 || info.Data1 == 5|| info.Data1 == 7)
+                    {
+                        //娓╁害
+                        dicSort[temparetureNo] = $"{ info.Data2 / 100}鈩�";
+                    }
+                    else if (info.Data1 == 6)
+                    {
+                        if (info.Data2 == 1)
+                        {
+                            //浣庨
+                            dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Low);
+                        }
+                        else if (info.Data2 == 2)
+                        {
+                            //涓
+                            dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Middle);
+                        }
+                        else if (info.Data2 == 3)
+                        {
+                            //楂橀
+                            dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Height);
+                        }
+                    }
+                }
+                #endregion
+            }
+            //濡傛灉寮�鍏冲拰鐧惧垎姣斾竴璧峰瓨鍦ㄧ殑璇�,鍒欎笉鏄剧ず寮�鍏虫枃瀛�
+            if (dicSort.ContainsKey(ControlNo) == true && dicSort.ContainsKey(persentNo) == true)
+            {
+                dicSort.Remove(ControlNo);
+            }
+
+            //鎷兼帴鏂囨湰
+            string txtvalue = string.Empty;
+            for (int i = 0; i <= MaxNo; i++)
+            {
+                if (dicSort.ContainsKey(i) == true)
+                {
+                    txtvalue += dicSort[i] + " ";
+                }
+            }
+            //鍏朵粬鐨�
+            MaxNo = otherNo + dicSort.Count;
+            for (int i = otherNo; i < MaxNo; i++)
+            {
+                if (dicSort.ContainsKey(i) == true)
+                {
+                    txtvalue += dicSort[i] + " ";
+                    continue;
+                }
+                break;
+            }
+
+            return txtvalue.Trim();
+        }
+
+        #endregion
+
+        #region 鈻� 閲嶇疆绠$悊鍛樺瘑鐮乢____________________
+
+        /// <summary>
+        /// 閲嶇疆绠$悊鍛樺瘑鐮�
+        /// </summary>
+        /// <param name="password">鏂板瘑鐮�</param>
+        /// <returns></returns>
+        private async Task<bool> DoResetAdministratorPsw(string password)
+        {
+            var realWay = ZigBee.Device.ZbGateway.MainGateWay;
+            if (realWay == null)
+            {
+                //閿欒:缃戝叧瀵硅薄涓㈠け
+                //string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
+                //this.ShowTipMsg(msg);
+                return false;
+            }
+            //鏄惁杈炬垚涓柇鐨勬椂鏈�
+            bool canBreak = false;
+            bool success = false;
+            //瓒呮椂鏃堕棿
+            int TimeOut = 0;
+            string checkTopic = realWay.GwId + "/Security/AdminSetNewPassword_Respon";
+            Action<string, string> getResultAction = (topic, message) =>
+            {
+                try
+                {
+                    if (topic == checkTopic)
+                    {
+                        TimeOut = 0;
+                        var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
+                        var result = JsonConvert.DeserializeObject<int>(jobject["Data"]["Result"].ToString());
+                        success = result == 0;
+                        canBreak = true;
+                    }
+                }
+                catch { }
+            };
+
+            realWay.Actions += getResultAction;
+            try
+            {
+                var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 4033 } };
+                var data = new Newtonsoft.Json.Linq.JObject { { "HomeId", Common.Config.Instance.HomeId }, { "Password", password } };
+                jObject.Add("Data", data);
+                realWay.Send("Security/AdminSetNewPassword", jObject.ToString());
+            }
+            catch
+            {
+                canBreak = true;
+                //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇�
+                //string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain);
+                //this.ShowTipMsg(msg);
+            }
+
+            while (canBreak == false && TimeOut < 20)
+            {
+                await Task.Delay(100);
+                TimeOut++;
+            }
+
+            realWay.Actions -= getResultAction;
+            getResultAction = null;
+
+            if (TimeOut >= 20)
+            {
+                //閲嶇疆绠$悊鍛樺瘑鐮佸け璐�(缃戝叧鍥炲瓒呮椂)
+                //string msg = Language.StringByID(R.MyInternationalizationString.uResetAdministratorPswFail);
+                //msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "鍥炲瓒呮椂");
+                //this.ShowTipMsg(msg);
+                return false;
+            }
+            return success;
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夐槻鍖虹殑ID(榛樿鏄�1锝�5)
+        /// </summary>
+        /// <returns></returns>
+        private List<int> GetAllZoneId()
+        {
+            //闃插尯id
+            //1锛�24灏忔椂闃插尯
+            //2锛�24灏忔椂闈欓煶闃插尯
+            //3锛氬嚭鍏ラ槻鍖�
+            //4锛氬唴閮ㄩ槻鍖�
+            //5锛氬懆鐣岄槻鍖�
+            List<int> list = new List<int>() { 1, 2, 3, 4, 5 };
+            return list;
+        }
+
+        /// <summary>
+        /// 鑾峰彇闃插尯鐨勭炕璇戝悕瀛�
+        /// </summary>
+        /// <param name="ZoneID"></param>
+        /// <returns></returns>
+        public string GetGarrisonText(int ZoneID)
+        {
+            if (ZoneID == 1)
+            {
+                //24灏忔椂闃插尯
+                return Language.StringByID(R.MyInternationalizationString.u24HourSectors);
+            }
+            else if (ZoneID == 2)
+            {
+                //闈欓煶闃插尯
+                return Language.StringByID(R.MyInternationalizationString.uMuteSectors);
+            }
+            else if (ZoneID == 3)
+            {
+                //鍑哄叆闃插尯
+                return Language.StringByID(R.MyInternationalizationString.uInAndOutSectors);
+            }
+            else if (ZoneID == 4)
+            {
+                //鍐呴儴闃插尯
+                return Language.StringByID(R.MyInternationalizationString.uInteriorSectors);
+            }
+            else if (ZoneID == 5)
+            {
+                //鍛ㄧ晫闃插尯
+                return Language.StringByID(R.MyInternationalizationString.uPerimeterSectors);
+            }
+            return string.Empty;
+        }
+
+        /// <summary>
+        /// 鏄剧ず閿欒淇℃伅绐楀彛
+        /// </summary>
+        /// <param name="msg"></param>
+        private void ShowErrorMsg(string msg)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                var contr = new ShowMsgControl(ShowMsgType.Error, msg);
+                contr.Show();
+            });
+        }
+
+        /// <summary>
+        /// 鏄剧ず姝e父淇℃伅绐楀彛
+        /// </summary>
+        /// <param name="msg"></param>
+        private void ShowNormalMsg(string msg)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                var contr = new ShowMsgControl(ShowMsgType.Normal, msg);
+                contr.Show();
+            });
+        }
+
+        /// <summary>
+        /// 鏄剧ずTip绐楀彛
+        /// </summary>
+        /// <param name="msg"></param>
+        private void ShowTipMsg(string msg)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                var control = new ShowMsgControl(ShowMsgType.Tip, msg);
+                control.Show();
+            });
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁惧鐨勫敮涓�涓婚敭
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        private string GetDeviceMainKeys(CommonDevice device)
+        {
+            return Common.LocalDevice.Current.GetDeviceMainKeys(device);
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐧婚檰鑰呯殑Token(濂藉儚绠$悊鍛樼櫥闄嗙殑鏃跺��,闇�瑕佸彉鏇碩oken,鎵�浠ユ殏涓斿畾涔変竴涓嚱鏁板嚭鏉�)
+        /// </summary>
+        /// <returns></returns>
+        public string GetLoginToken()
+        {
+            //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
+            //return UserCenterLogic.GetConnectMainToken();
+            return Config.Instance.Token;
+        }
+
+        #endregion
+
+        #region 鈻� 缁撴瀯浣揰____________________________
+
+        /// <summary>
+        /// 鍐呴儴浣跨敤锛屽畨闃查槻鍖虹殑涓�浜涗俊鎭�
+        /// </summary>
+        private class SafeguardZoneInfo
+        {
+            /// <summary>
+            /// 闃插尯id銆�
+            /// </summary>
+            public int ZoneId;
+            /// <summary>
+            /// 甯冮槻闃插尯鍚嶇О 锛屾渶澶�32涓瓧绗�
+            /// </summary>
+            public string ZoneName;
+            /// <summary>
+            /// 淇℃伅鎺ㄩ�� 0:鎺ㄩ��  1:涓嶆帹閫� 
+            /// </summary>
+            public int InformationPush = 1;
+            /// <summary>
+            /// 浼犳劅鍣ㄨ澶囩殑淇℃伅(keys:璁惧涓婚敭)
+            /// </summary>
+            public Dictionary<string, Safeguard.ZoneDeviceListData> dicSensor = new Dictionary<string, Safeguard.ZoneDeviceListData>();
+            /// <summary>
+            /// 璇ラ槻鍖轰笅鍏ㄩ儴璁惧鏂囦欢璺緞(keys:璁惧涓婚敭,value:璁惧鏂囦欢璺緞)
+            /// </summary>
+            public Dictionary<string, string> dicAllDevice = new Dictionary<string, string>();
+            /// <summary>
+            /// 璇ラ槻鍖轰笅闈㈢殑鎶ヨ璁惧(keys:璁惧涓婚敭),锛滃彧鏈夐槻鍖篒D:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑锛�
+            /// </summary>
+            public Dictionary<string, Safeguard.CatActionResponseObj> dicAlarmDevice = new Dictionary<string, Safeguard.CatActionResponseObj>();
+            /// <summary>
+            /// 璇ラ槻鍖轰笅闈㈢殑鍦烘櫙(keys:鍦烘櫙No),锛滃彧鏈夐槻鍖篒D:1,2,3鎵嶄細鏈夈��4,5鐨勯兘褰掍负3,鍥犱负瀹冩槸浠ラ槻鍖烘ā寮廔D(ActionType)涓哄崟浣嶇殑锛�
+            /// </summary>
+            public Dictionary<int, string> dicScenes = new Dictionary<int, string>();
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0