WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
old mode 100755 new mode 100644
@@ -722,6 +722,7 @@
            //new一个新逻辑对象;
            Common.Logic.CurrentLogic = new Common.Logic();
            Common.Logic.CurrentLogic.IsEnable = 1;//默认为开
            Common.Logic.CurrentLogic.LogicCustomPushText = Language.StringByID(MyInternationalizationString.defaulttext);
            Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
            var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage();
            UserView.HomePage.Instance.AddChidren(addLogicPage);
@@ -1740,14 +1741,14 @@
        #endregion
        #region ◆ 自动化__________________________
        /// <summary>
        /// 自动化
        /// 自动化功能代码入口
        /// </summary>
        private async void ShowAutotion()
        private  void ShowAutotion()
        {
            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            var bjFrameLayout = new FrameLayout
            {
                Width = Application.GetRealWidth(1080 - 58),
@@ -1758,7 +1759,7 @@
                Y = Application.GetRealHeight(30),
            };
            functionSceneAutoBodyView.AddChidren(bjFrameLayout);
            bjFrameLayout.SetCornerWithSameRadius(25, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
            bjFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
            var sigBtn = new Button
            {
                Width = Application.GetMinRealAverage(84),
@@ -1779,7 +1780,7 @@
                TextID = MyInternationalizationString.logictemplate,
                Gravity = Gravity.CenterVertical,
                TextColor = ZigbeeColor.Current.LogicBtnSelectedColor,
                TextSize=15,
                TextSize = 15,
            };
            bjFrameLayout.AddChidren(recommendtextBtn);
@@ -1804,18 +1805,16 @@
            };
            functionSceneAutoBodyView.AddChidren(scenehorizontalScrol);
            var logicScrolView = new VerticalScrolViewLayout
            var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
            {
                Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/
                X = Application.GetRealWidth(58),
                //Radius = (uint)Application.GetRealHeight(50),
                Y = scenehorizontalScrol.Bottom,
            };
            functionSceneAutoBodyView.AddChidren(logicScrolView);
            logicScrolView.SetCornerWithSameRadius(20, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
            logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
            bool no = false;
            recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
            {
                int Yheight = 0;
@@ -1823,6 +1822,7 @@
                scenehorizontalScrol.RemoveAll();
                if (recommendswitchBtn.IsSelected)
                {
                    no = true;
                    scenehorizontalScrol.Height = Application.GetRealHeight(246);
                    Yheight = 20;
                    for (int i = 1; i < 4; i++)
@@ -1898,21 +1898,39 @@
                }
                else
                {
                    no = false;
                    scenehorizontalScrol.Height = Application.GetRealHeight(0);
                    Yheight = 0;
                }
                logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
                Automationview(logicScrolView);
                Automationview(logicScrolView,no);
            };
            logicScrolView.BeginHeaderRefreshingAction += () =>
            {
                //重新刷新logic列表
                Common.Logic.LogicList.Clear();
                Read(logicScrolView,no);
                //关闭刷新View;
                logicScrolView.EndHeaderRefreshing();
            };
            Read(logicScrolView,no);
        }
        /// <summary>
        /// 读取自动化列表数据;
        /// </summary>
        /// <param name="logicScrolView"></param>
        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
        {
            CommonPage.Loading.Start();
            if (Common.Logic.LogicList.Count == 0)
            {
                var Idlist = await Logic.Send.GetLogicId(0);
                if (Idlist.Count != 0)
                {
                    var listlogic = await Logic.Send.ReadList(Idlist.Count,0);
                    var listlogic = await Logic.Send.ReadList(Idlist.Count, 0);
                    //foreach可能集合已被修改,枚举操作可能不会执行,可能出现崩溃(建议for)。
                    for (int j = 0; j < listlogic.Count; j++)
                    {
@@ -1926,18 +1944,66 @@
                }
            }
            //自动化
            Automationview(logicScrolView);
            Automationview(logicScrolView,no);
            CommonPage.Loading.Hide();
        }
        /// <summary>
        /// 自动化列表界面
        /// 加载自动化列表界面
        /// </summary>
        /// <param name="refresview">Refresview.</param>
        private async void Automationview(VerticalScrolViewLayout refresview)
        private async void Automationview(VerticalRefreshLayout refresview,bool no)
        {
            refresview.RemoveAll();
            if (Common.Logic.LogicList.Count == 0&&no==false)
            {
                //就是为了显示引导添加图标;
                refresview.BackgroundColor = 0x00000000;
                var noFrameLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(434+ 200+32+160),
                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                refresview.AddChidren(noFrameLayout);
                var noIconBtn = new Button
                {
                    Y=Application.GetRealHeight(160),
                    Width = Application.GetMinRealAverage(756),
                    Height = Application.GetMinRealAverage(434),
                    UnSelectedImagePath = "Item/NoFunction.png",
                    X = Application.GetRealWidth(104),
                };
                noFrameLayout.AddChidren(noIconBtn);
                var noTextBtn = new Button()
                {
                    Y = noIconBtn.Bottom,
                    Height = Application.GetRealHeight(200)+Application.GetRealHeight(32),
                    Width = Application.GetRealWidth(700),
                    //Gravity = Gravity.CenterHorizontal,
                    Text = Language.StringByID(MyInternationalizationString.automationaddtext).Replace("{\\r\\n}", "\r\n"),
                    TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                    TextAlignment = TextAlignment.Center,
                    IsMoreLines = true,
                    X = Application.GetRealWidth(190-58),
                };
                noFrameLayout.AddChidren(noTextBtn);
            }
            else
            {
                if (Common.Logic.LogicList.Count == 0 && no == true)
                {
                    ///改变滑动view的颜色;
                    refresview.BackgroundColor = 0x00000000;
                }
                else
                {
                    refresview.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
                }
            }
            foreach (var logic in Common.Logic.LogicList)
            {
@@ -1945,7 +2011,7 @@
                var logicRowlayout = new RowLayout
                {
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080),
                    Width = Application.GetRealWidth(1080-58),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
@@ -2022,7 +2088,7 @@
                    var logicCommunalPage = new Logic.LogicCommunalPage();
                    HomePage.Instance.AddChidren(logicCommunalPage);
                    HomePage.Instance.PageIndex += 1;
                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview); });
                    logicCommunalPage.Show(() => { logicnameBtn.Text = logic.LogicName; Automationview(refresview,no); });
                };
@@ -2044,7 +2110,7 @@
                        if (e1)
                        {
                            Common.Logic.LogicList.Remove(logic);
                            Automationview(refresview);
                            Automationview(refresview,no);
                            Logic.Send.DelLogic(logic.LogicId);
                        }
                    };
@@ -2064,7 +2130,7 @@
        }
        /// <summary>
        /// 显示图标的颜色
        /// 显示自动化输出功能模块图标的颜色
        /// </summary>
        /// <param name="logic"></param>
        /// <param name="logicRowlayout"></param>
@@ -2463,6 +2529,7 @@
                }
            }
        }
        #endregion
        #region ◆ 控制状态_________________________