黄学彪
2020-04-15 23532fa8ad34c89b6d24b01eaef6475fd0aad898
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -93,6 +93,32 @@
                });
                return;
            }
            else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Home.Id + "_" + Common.Config.Instance.Guid + "/PrimaryUserDelYou")
            {
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //分享住宅已更改,请联系管理员!
                    string msg = Language.StringByID(R.MyInternationalizationString.uShardResidenceHadDeletePleaseTakeToAdmin);
                    var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
                    contr.Show();
                    UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false);
                });
                return;
            }
            else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Update")
            {
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //您的权限已经变更,请重新登陆
                    string msg = Language.StringByID(R.MyInternationalizationString.uYouAccessHadChangedPleaseTakeToAdmin);
                    var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
                    contr.Show();
                    UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false);
                });
                return;
            }
            else if (UserCenterResourse.UserInfo.AuthorityNo == 3)
            {
                if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted"
@@ -102,19 +128,6 @@
                    {
                        //分享数据已经变更,请重新登陆
                        string msg = Language.StringByID(R.MyInternationalizationString.uShardDataIsChangedPleaseLoginAgain);
                        var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
                        contr.Show();
                        UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false);
                    });
                    return;
                }
                else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Home.Id + "_" + Common.Config.Instance.Guid + "/PrimaryUserDelYou")
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //分享住宅已更改,请联系管理员!
                        string msg = Language.StringByID(R.MyInternationalizationString.uShardResidenceHadDeletePleaseTakeToAdmin);
                        var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
                        contr.Show();
@@ -145,7 +158,7 @@
                //门锁上报
                else if (topic == gatewayId + "/Alarms/SendAlarmInform")
                {
                    this.DoorLockDeviceReportPush(null);
                    this.DoorLockDeviceReportPush(JObject.Parse(msgData));
                }
                //通过外部方式布防撤防成功时报告
                else if (topic == gatewayId + "/Security/EnOrWithdrawSucceedReport")
@@ -484,9 +497,25 @@
        /// <param name="receiveData"></param>
        private void DoorLockDeviceReportPush(JObject receiveData)
        {
            //保存门锁信息到本地
            //HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData);
            //只有徐梅的门锁界面没有打开的情况下,才会处理这个东西
            if (ControlCommonResourse.IsDoorLockPageOpen == false)
            {
                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
                if ((device is ZigBee.Device.DoorLock) == false)
                {
                    //它不是门锁
                    return;
                }
                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
                if (info.Clusterid == 257)
                {
                    //常开模式开启
                    if (info.AlarmCode == 216)
                    {
                        DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, null);
                    }
                }
            }
            //显示有新消息的特效
            this.ShowHadNewMessageAppeal();
        }
@@ -786,19 +815,23 @@
                //没有添加监听
                return;
            }
            lock (this.dicDeviceEvent)
            //lock (this.dicDeviceEvent)
            {
                var list = new List<Action<CommonDevice>>();
                foreach (string keys in this.dicDeviceEvent.Keys)
                try
                {
                    if (this.dicCommandDiv[keys] != comand)
                    foreach (string keys in this.dicDeviceEvent.Keys)
                    {
                        //命令区分不一致,则不调用回调函数
                        continue;
                        if (this.dicCommandDiv[keys] != comand)
                        {
                            //命令区分不一致,则不调用回调函数
                            continue;
                        }
                        //命令区分一致时,则调用回调函数
                        list.Add(this.dicDeviceEvent[keys]);
                    }
                    //命令区分一致时,则调用回调函数
                    list.Add(this.dicDeviceEvent[keys]);
                }
                catch { return; }
                //有可能在回调函数中移除了事件,导致报错,所以先收集,再调用
                foreach (var action in list)
                {