陈嘉乐
2020-09-02 652243206427f35a256400a149a1734085824cb9
ZigbeeApp/Shared/Phone/Device/Logic/IgnoreTime.cs
old mode 100644 new mode 100755
@@ -16,7 +16,7 @@
        }
        Button selectedIcon = new Button();
        public void Show(CommonDevice common, string name, bool edit, int timevalue)
        public void Show(CommonDevice common, string name, bool edit, int timevalue,string _if)
        {
            #region  上面的布局代码
@@ -29,80 +29,55 @@
            var middle = new VerticalScrolViewLayout
            {
                Y = view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184 - 260),
                Height = Application.GetRealHeight(Method.H - 184 - 260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
            LogicView.SaveView saveView = new LogicView.SaveView();
            saveView.frameLayout.Y = middle.Bottom;
            this.AddChidren(saveView.Show());
            int selectetimedvalue = 0;
            var timestrlist = new List<string> { "2", "5", "10", "20", "30", Language.StringByID(MyInternationalizationString.logiccustom) };
            foreach (var intvalue in timestrlist)
            foreach (var intValue in timestrlist)
            {
                var timeframelayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(160),
                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                };
                middle.AddChidren(timeframelayout);
                var timeniconBtn = new Button
                {
                    Width = Application.GetRealWidth(81),
                    Height = Application.GetRealHeight(81),
                    X = Application.GetRealWidth(58),
                    Y = Application.GetRealHeight(55),
                    UnSelectedImagePath = "ZigeeLogic/point.png",
                };
                timeframelayout.AddChidren(timeniconBtn);
                var timeRow = new RowLayout
                {
                    Y = Application.GetRealHeight(30),
                    Width = Application.GetRealWidth(850),
                    Height = Application.GetRealHeight(130),
                    X = Application.GetRealWidth(176),
                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                };
                timeframelayout.AddChidren(timeRow);
                var timeBtn = new Button
                {
                    Text = intvalue.ToString() + Language.StringByID(MyInternationalizationString.Minute),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    Tag = intvalue,
                    TextSize = 14,
                };
                timeRow.AddChidren(timeBtn);
                FunView monView = new FunView();
                monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png";
                monView.funnameBtn.Text = intValue + Language.StringByID(MyInternationalizationString.Minute);
                monView.funnameBtn.Tag = intValue;
                monView.funnextBtn.Width = Application.GetMinRealAverage(60);
                monView.funnextBtn.Height = Application.GetMinRealAverage(60);
                monView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
                monView.funnextBtn.Visible = false;
                middle.AddChidren(monView.FunFrameView());
                var selected = new SelectedButton(789);
                timeRow.AddChidren(selected);
                //判断一个字符是字符串还是数字
                if (intvalue.Length < 3)
                if (intValue.Length < 3)
                {
                    if (timevalue== int.Parse(intvalue) * 60)
                    if (timevalue == int.Parse(intValue) * 60)
                    {
                        selectedIcon.Visible = false;
                        selectedIcon = selected;
                        selected.Visible = true;
                        selectedIcon = monView.funnextBtn;
                        monView.funnextBtn.Visible = true;
                    }
                }
                else
                {
                    timeRow.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
                    monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度;
                    monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色
                }
                EventHandler<MouseEventArgs> timeclick = (sender, e) =>
                monView.clickviewBtn.MouseUpEventHandler+= (sender, e) =>
                {
                    selectedIcon.Visible = false;
                    selectedIcon = selected;
                    selected.Visible = true;
                    if (Language.StringByID(MyInternationalizationString.logiccustom) == timeBtn.Tag.ToString())
                    selectedIcon = monView.funnextBtn;
                    monView.funnextBtn.Visible = true;
                    if (Language.StringByID(MyInternationalizationString.logiccustom) == monView.funnameBtn.Tag.ToString())
                    {
                        var secondList = new List<string>();
                        var minuteList = new List<string>();
                        for (int i = 0; i < 61; i++)
                        for (int i = 0; i < 60; i++)
                        {
                            if (i < 10)
                            {
@@ -129,51 +104,27 @@
                            selectIndex1 = timevalue / 60;
                            selectIndex2 = timevalue % 60;
                        }
                        PickerView.ShowNormal(minuteList, secondList, new List<string>(), (Index1, Index2, Index3) =>
                        PickerView.ShowNormal(minuteList, secondList, null, (Index1, Index2, Index3) =>
                          {
                              selectetimedvalue = int.Parse(minuteList[Index1].Split(' ')[0]) * 60 + int.Parse(secondList[Index2].Split(' ')[0]);
                              timemethod(common, selectetimedvalue, timevalue, edit);
                              TimeMethod(common, selectetimedvalue, timevalue, edit, _if);
                          }, selectIndex1, selectIndex2, 0, Language.StringByID(MyInternationalizationString.logiccustom));
                    }
                    else
                    {
                        selectetimedvalue = int.Parse(timeBtn.Tag.ToString()) * 60;
                        selectetimedvalue = int.Parse(monView.funnameBtn.Tag.ToString()) * 60;
                    }
                };
                timeframelayout.MouseUpEventHandler += timeclick;
                timeniconBtn.MouseUpEventHandler += timeclick;
                timeRow.MouseUpEventHandler += timeclick;
                timeBtn.MouseUpEventHandler += timeclick;
                selected.MouseUpEventHandler += timeclick;
            }
            var saveFrameLayout = new FrameLayout
            saveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                Y = middle.Bottom,
                Height = Application.GetRealHeight(260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(saveFrameLayout);
            var btnsave = new Button
            {
                X = Application.GetRealWidth(85),
                Height = Application.GetRealHeight(130),//194
                Width = Application.GetRealWidth(910),
                Radius = (uint)Application.GetRealHeight(60),
                BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                TextID = MyInternationalizationString.Save,
                TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
                TextSize = 16,
            };
            saveFrameLayout.AddChidren(btnsave);
            btnsave.MouseUpEventHandler += (sender, e) =>
            {
                timemethod(common, selectetimedvalue, timevalue, edit);
                TimeMethod(common, selectetimedvalue, timevalue, edit,_if);
            };
        }
        public void timemethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit)
        public void TimeMethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit,string  _if)
        {
            var deviceConditionsInfo = new Dictionary<string, string>();
@@ -183,9 +134,9 @@
            deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString());
            deviceConditionsInfo.Add("Cluster_ID", "1280");
            deviceConditionsInfo.Add("AttriButeId", "1281");
            deviceConditionsInfo.Add("AttriButeData1", "0");
            deviceConditionsInfo.Add("AttriButeData1", "1");
            deviceConditionsInfo.Add("AttriButeData2", "0");
            deviceConditionsInfo.Add("Range", "1");
            deviceConditionsInfo.Add("Range", "5");
            if (selectetimedvalue != 0)
            {
                if (timevalue != selectetimedvalue)
@@ -212,10 +163,35 @@
                }
            }
            var logicCommunalPage = new LogicCommunalPage();
            UserView.HomePage.Instance.AddChidren(logicCommunalPage);
            UserView.HomePage.Instance.PageIndex += 1;
            logicCommunalPage.Show(() => { });
            switch (_if)
            {
                case "logic":
                    {
                        //自动化
                        var logicCommunalPage = new LogicCommunalPage();
                        UserView.HomePage.Instance.AddChidren(logicCommunalPage);
                        UserView.HomePage.Instance.PageIndex += 1;
                        logicCommunalPage.Show(() => { });
                    }
                    break;
                case "mould":
                    {
                        //自动化推荐模板
                        var templatePage = new TemplatePage();
                        UserView.HomePage.Instance.AddChidren(templatePage);
                        UserView.HomePage.Instance.PageIndex += 1;
                        templatePage.Show();
                    }
                    break;
            }
            //var logicCommunalPage = new LogicCommunalPage();
            //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
            //UserView.HomePage.Instance.PageIndex += 1;
            //logicCommunalPage.Show(() => { });
        }
    }