WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -1747,8 +1747,7 @@
        /// </summary>
        private  void ShowAutotion()
        {
            functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
           
            var bjFrameLayout = new FrameLayout
            {
@@ -1809,14 +1808,13 @@
            var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout
            {
                Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                //BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,/
                X = Application.GetRealWidth(58),
                //Radius = (uint)Application.GetRealHeight(50),
                Y = scenehorizontalScrol.Bottom,
            };
            functionSceneAutoBodyView.AddChidren(logicScrolView);
            logicScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
            bool no = false;
            recommendswitchBtn.MouseUpEventHandler += (sender, e) =>
            {
                int Yheight = 0;
@@ -1824,6 +1822,7 @@
                scenehorizontalScrol.RemoveAll();
                if (recommendswitchBtn.IsSelected)
                {
                    no = true;
                    scenehorizontalScrol.Height = Application.GetRealHeight(246);
                    Yheight = 20;
                    for (int i = 1; i < 4; i++)
@@ -1899,30 +1898,31 @@
                }
                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);
                Read(logicScrolView,no);
                //关闭刷新View;
                logicScrolView.EndHeaderRefreshing();
            };
           
            Read(logicScrolView);
            Read(logicScrolView,no);
        }
        /// <summary>
        /// 读取自动化列表数据;
        /// </summary>
        /// <param name="logicScrolView"></param>
        private async void Read(VerticalRefreshLayout logicScrolView)
        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
        {
            CommonPage.Loading.Start();
            if (Common.Logic.LogicList.Count == 0)
@@ -1944,17 +1944,66 @@
                }
            }
            //自动化
            Automationview(logicScrolView);
            Automationview(logicScrolView,no);
            CommonPage.Loading.Hide();
        }
        /// <summary>
        /// 加载自动化列表界面
        /// </summary>
        /// <param name="refresview">Refresview.</param>
        private async void Automationview(VerticalRefreshLayout 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)
            {
@@ -2039,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); });
                };
@@ -2061,7 +2110,7 @@
                        if (e1)
                        {
                            Common.Logic.LogicList.Remove(logic);
                            Automationview(refresview);
                            Automationview(refresview,no);
                            Logic.Send.DelLogic(logic.LogicId);
                        }
                    };