HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/Device/Logic/OneLogic.cs
old mode 100755 new mode 100644
@@ -24,8 +24,8 @@
        /// <param name="Yes"></param>
        public  void Show(bool Yes)
        {
             UserView.HomePage.Instance.ScrollEnabled = false;
            #region  View布局代码
            UserView.HomePage.Instance.ScrollEnabled = false;
            TopView view = new TopView();
            this.AddChidren(view.TopRowView());
@@ -47,13 +47,13 @@
            
            view.clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                // UserView.HomePage.Instance.ScrollEnabled = true;//恢复左滑
                UserView.HomePage.Instance.ScrollEnabled = true;//恢复左滑
                RemoveFromParent();
            };
            var middle = new VerticalScrolViewLayout
            {
                Y = view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184 - 180),
                Height = Application.GetRealHeight(Method.H - 184 - 180),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
@@ -130,20 +130,25 @@
                var conditions = Common.Logic.CurrentLogic.Conditions[i];
                switch (Type)
                {
                    case 5:
                    case 0:
                        {
                            selecteddevice.ordinaryBtn.Visible = true;
                            selecteddevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/timeparagraph.png";
                            string s1 = "", s2 = "";
                            s1 = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
                            s2 = conditions["StopMin"].Length < 2 ? "0" + conditions["StopMin"] : conditions["StopMin"];
                            ///显示时间
                            selecteddevice.ordinaryBtn.Text = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2;
                            selecteddevice.selecetddevicestateBtn.Text = Language.StringByID(MyInternationalizationString.timeframe);
                            //"0正常时间点","1日出时间","2日落时间","3正午时间"
                            switch (int.Parse(conditions["DateType"]))
                            {
                                case 0:
                                    {
                                        selecteddevice.ordinaryBtn.Text = Language.StringByID(MyInternationalizationString.immediateexecution);
                                        selecteddevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/timepoint.png";
                                        string s = "";
                                        s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
                                        selecteddevice.selecetddevicestateBtn.Text= conditions["StartHour"] + ":" + s;
                                    }
                                    break;
                            }
                        }
                        break;
                }
                if (Yes)
                {
@@ -154,13 +159,19 @@
                ///编辑
                selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
                {
                    if (Type==5) {
                        var timePage = new TimePage();
                        UserView.HomePage.Instance.AddChidren(timePage);
                    if (Type == 0)
                    {
                        var oneTimePoint = new OneTimePoint();
                        UserView.HomePage.Instance.AddChidren(oneTimePoint);
                        UserView.HomePage.Instance.PageIndex += 1;
                        timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"];
                        timePage.IsEditor = true;
                        timePage.Show(true);
                        oneTimePoint.Show((timeString) =>
                        {
                            if (!string.IsNullOrEmpty(timeString))
                            {
                                //编辑完回来先更新时间
                                selecteddevice.selecetddevicestateBtn.Text = timeString;
                            }
                        });
                    }
                };
@@ -182,17 +193,15 @@
                    //S-one门锁特殊,不能再次编辑;
                    actiondevice.stateRow.AddRightView(actiondevice.edit);
                }
                var linkType = int.Parse(Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString());
                var actions = Common.Logic.CurrentLogic.Actions[i];
                switch (linkType)
                {
                    case 8:
                        {
                            var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
                            //S-one门锁特殊(Mac是唯一的识别)
                            ///如果不这样查找,分类-自动化进来查看会存在问题
                            var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return  obj.DeviceAddr == actions["DeviceAddr"].ToString(); });
                            if (deviceinof == null)
                            {
                                deviceinof = new CommonDevice();
@@ -230,7 +239,6 @@
                        break;
                }
                ///编辑
                actiondevice.edit.MouseUpEventHandler += (sender, e) =>
                {
@@ -238,7 +246,9 @@
                    {
                        case 8:
                            {
                                var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
                                //S-one门锁特殊(Mac是唯一的识别)
                                ///如果不这样查找,分类-自动化进来查看会存在问题
                                var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == actions["DeviceAddr"].ToString(); });
                                if (deviceinof == null)
                                {
                                    deviceinof = new CommonDevice();
@@ -290,7 +300,7 @@
                var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); });
                UserView.HomePage.Instance.AddChidren(cycle);
                UserView.HomePage.Instance.PageIndex += 1;
                cycle.Show();
                cycle.Show(LogicView.IfString._LockLogic, Yes);
            };
            weekBtn.MouseUpEventHandler += cycleclick;
            weekview.clickBtn.MouseUpEventHandler += cycleclick;
@@ -315,14 +325,12 @@
                    return;
                }
                var name = logicTextBox.Text.Trim();
                Method.SaveLogic(IfString._Logic, name, IfString.Tag, Common.Logic.CurrentLogic);
                Method.SaveLogic(IfString._SoneLogic, name, IfString.Tag, Common.Logic.CurrentLogic);
            };
        }
        /// <summary>
        /// 选中该设备功能作为条件或者目标的视图方法
        /// 选中该作为条件或者目标的视图方法
        /// </summary>
        /// <param name="common">Common.</param>
         void DevcieView( CommonDevice common,Button button)
@@ -360,7 +368,7 @@
            Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
            actionsInfo.Add("LinkType", 8);
            actionsInfo.Add("DeviceAddr", common.DeviceAddr);
            actionsInfo.Add("Epoint", common.DeviceEpoint);
            actionsInfo.Add("Epoint","200");
            string SelectedDeviceStatus = "";
            switch (common.Type)
            {
@@ -395,34 +403,24 @@
                        };
                        foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions)
                        if (button.Text == Language.StringByID(MyInternationalizationString.logicopen))
                        {
                            if (deviceinfo["LinkType"].ToString() == "8")
                            {
                                if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
                                {
                                    if (deviceinfo["PassData"].ToString() == "055704010112")
                                    {//开启
                                        SelectedDeviceStatus = Language.StringByID(MyInternationalizationString.logicopen);
                                        openView.selectedIconBtn.Visible = true;
                                        closeView.selectedIconBtn.Visible = false;
                                        openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                                        closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                    }
                                    else
                                    {//关闭
                                        SelectedDeviceStatus = Language.StringByID(MyInternationalizationString.logicclose);
                                        openView.selectedIconBtn.Visible = false;
                                        closeView.selectedIconBtn.Visible = true;
                                        openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                        closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            //开启
                            SelectedDeviceStatus = Language.StringByID(MyInternationalizationString.logicopen);
                            openView.selectedIconBtn.Visible = true;
                            closeView.selectedIconBtn.Visible = false;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                                    }
                                    break;
                                }
                            }
                        }
                        else {
                            //关闭
                            SelectedDeviceStatus = Language.StringByID(MyInternationalizationString.logicclose);
                            openView.selectedIconBtn.Visible = false;
                            closeView.selectedIconBtn.Visible = true;
                            openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
                            closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
                        }
                    }
                    break;