wxr
2024-07-02 b822232f0743d22e5bd3847eb993894bf090b214
HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -2,6 +2,7 @@
using Shared;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
namespace HDL_ON.UI.UI2.Intelligence.Automation
@@ -737,6 +738,78 @@
                        }
                    }
                    break;
                //大华摄像头
                case SPK.IpCam_Imou:
                    {
                        LogicView.FunTypeView view = new LogicView.FunTypeView();
                        view.btnText.TextID = StringId.quyuruqingaojing;
                        view.btnText.Name = Language.StringByID(StringId.shipintonghuahujiao);
                        fLayout.AddChidren(view.FLayoutView());
                        view.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            this.identifier = "ipcam_region_alram_event";
                            this.DeviceView(device, view.btnState, StringId.shi, StringId.offLogic, 1);
                        };
                        if (edit)
                        {
                            this.GetEditState(device, index, view.btnState, null, null, null);
                        }
                    }
                    break;
                //萤石视频门锁
                case SPK.VideoDoorLock:
                    {
                        LogicView.FunTypeView view1 = new LogicView.FunTypeView();
                        view1.btnText.TextID=StringId.kaimenrenyuan;
                        view1.btnText.Name = Language.StringByID(StringId.shipinmensuo);
                        fLayout.AddChidren(view1.FLayoutView());
                        view1.btnClick.MouseUpEventHandler += (sender, e) =>
                        {
                            this.identifier = "open_door";//开锁事件
                            this.VideoDoorLockAction(this, device, view1.btnState);
                        };
                        if (edit)
                        {
                            this.GetEditState(device, index, view1.btnState,null, null, null);
                        }
                    }
                    break;
                    //猫眼
                case SPK.Peephole:
                    LogicView.FunTypeView viewPeephole = new LogicView.FunTypeView();
                    viewPeephole.btnText.TextID = StringId.ActivityDetection;
                    //viewPeephole.btnText.Name = Language.StringByID(StringId.shipinmensuo);
                    fLayout.AddChidren(viewPeephole.FLayoutView());
                    viewPeephole.btnClick.MouseUpEventHandler += (sender, e) =>
                    {
                        this.identifier = "pir_event";//人体感应告警
                        this.DeviceView(device, viewPeephole.btnState, StringId.shi, StringId.offLogic, 1);
                    };
                    if (edit)
                    {
                        this.GetEditState(device, index, viewPeephole.btnState, null, null, null);
                    }
                    break;
                    //萤石摄像头
                case SPK.Ev_Ipcam:
                    LogicView.FunTypeView viewEzIpcam = new LogicView.FunTypeView();
                    viewEzIpcam.btnText.TextID = StringId.ActivityDetection;
                    //viewEzIpcam.btnText.Name = Language.StringByID(StringId.shipinmensuo);
                    fLayout.AddChidren(viewEzIpcam.FLayoutView());
                    viewEzIpcam.btnClick.MouseUpEventHandler += (sender, e) =>
                    {
                        this.identifier = Constant.intelligentDetection_event;//人体感应告警
                        this.DeviceView(device, viewEzIpcam.btnState, StringId.shi, StringId.offLogic, 1);
                    };
                    if (edit)
                    {
                        this.GetEditState(device, index, viewEzIpcam.btnState, null, null, null);
                    }
                    break;
            }
            #region  保存
            ///保存View
@@ -775,6 +848,38 @@
                    {
                        inputDevice.condition = new List<Dictionary<string, string>>();
                    }
                }
                else if (device.spk == SPK.IpCam_Imou)
                {
                    //大华摄像头
                    inputDevice.condition_type = "9";
                    inputDevice.identifier = this.identifier;
                    if (this.identifier == "ipcam_region_alram_event")
                    {
                        //condition默认[]
                        inputDevice.condition = new List<Dictionary<string, string>>();
                    }
                }
                else if(device.spk == SPK.Peephole)
                {
                    //猫眼-人体感应告警
                    inputDevice.condition_type = "9";
                    inputDevice.identifier = this.identifier;
                    inputDevice.condition = new List<Dictionary<string, string>>();
                }
                else if(device.spk == SPK.Ev_Ipcam)
                {
                    //萤石摄像头-移动监测告警
                    inputDevice.condition_type = "9";
                    inputDevice.identifier = this.identifier;
                    inputDevice.condition = new List<Dictionary<string, string>>();
                }
                else if (device.spk == SPK.VideoDoorLock)
                {
                    ////萤石视频门锁
                    inputDevice.condition_type = "9";
                    inputDevice.identifier = this.identifier;
                    //inputDevice.condition = new List<Dictionary<string, string>>();
                }
                else if (device.spk == SPK.SensorPirHold)
                {
@@ -1190,13 +1295,13 @@
            frame.AddChidren(loading);
            loading.Start();
            new System.Threading.Thread(() =>
            CommonMethod.Current.SunThread(() =>
            {
                try
                {
                    var faceIdList = Send.Current.GetListHomeFace(device.deviceId, true);
                    Application.RunOnMainThread(() =>
                    CommonMethod.Current.MainThread(() =>
                    {
                        loading.Hide();
                        string stateValue = btnState.Tag == null ? "" : btnState.Tag.ToString();
@@ -1207,7 +1312,7 @@
                         {
                             dicSateteList.Clear();
                             string userNameStr = string.Empty;
                             string seleUsrIdStr = string.Empty;
                             string seleUsrIdStr = string.Empty;
                             string tag = string.Empty;
                             string[] arrayUserIds = new string[indexeList.Count];
                             //开门类型
@@ -1245,8 +1350,76 @@
                    });
                }
            })
            { IsBackground = true }.Start() ;
            });
        }
        /// <summary>
        /// 萤石视频门锁专用
        /// </summary>
        /// <param name="frame">当前界面</param>
        /// <param name="device">当前设备</param>
        /// <param name="btnState">旧状态</param>
        public void VideoDoorLockAction(FrameLayout frame, Entity.Function device, Button btnState)
        {
            selectedState = device.spk + "_";
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
            CommonMethod.Current.SunThread(() =>
            {
                try
                {
                    var faceIdList = Send.Current.GetVideoDoorLockUserListInfo(device);
                    CommonMethod.Current.MainThread(() =>
                    {
                        loading.Hide();
                        string stateValue = btnState.Text == null ? "" : btnState.Text.ToString();
                        PublicInterface publicInterface = new PublicInterface();
                        publicInterface.MultiSelectShow(this, faceIdList, device.name, stateValue, (indexeList) =>
                        {
                            if (indexeList.Count > 0)
                            {
                                dicSateteList.Clear();
                                string seleTxet = string.Empty;
                                string tag = string.Empty;
                                string[] array = new string[indexeList.Count];
                                for (int i = 0; i < indexeList.Count; i++)
                                {
                                    if (i > faceIdList.Count)
                                    {
                                        continue;
                                    }
                                    var indexe = indexeList[i];
                                    var face = faceIdList[indexe];
                                    tag += face.userId;
                                    tag += "_";
                                    array[i] = face.userName;
                                }
                                seleTxet = Newtonsoft.Json.JsonConvert.SerializeObject(array);
                                //数据封装<高胜说萤石那边是推送用户名>
                                AddDictionary("open_user",seleTxet, "string", "[]");
                                //界面显示选中值
                                btnState.Text = InpOrOutLogicMethod.Current.RemoveLastStr(seleTxet);
                                btnState.Tag = tag;
                            }
                        });
                    });
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                    });
                }
            });
        }
@@ -1306,6 +1479,31 @@
            {
                //有数据重新赋值
                dicSateteList.AddRange(dicList);
            }
            //事件专用
            switch (device.spk)
            {
                case SPK.IpCam_Imou:
                    {
                        if (inputs.identifier == "ipcam_region_alram_event")
                        {
                            button1.Text = Language.StringByID(StringId.shi);
                        }
                    }
                    break;
                case SPK.Peephole:
                    if (inputs.identifier == "pir_event")
                    {
                        button1.Text = Language.StringByID(StringId.shi );
                    }
                    break;
                case SPK.Ev_Ipcam:
                    if (inputs.identifier == Constant.intelligentDetection_event)
                    {
                        button1.Text = Language.StringByID(StringId.shi);
                    }
                    break;
            }
            InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4, "");
        }
@@ -1429,7 +1627,7 @@
            {
                return false;
            }
            if (
            if (this.function.spk == SPK.VideoDoorLock ||
               this.function.spk == SPK.doorgate
                )
            {