黄学彪
2020-03-23 21923381bdac04d1633b168c97accc81f0898d84
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -123,30 +123,7 @@
        #endregion
        #region ◆ 接口____________________________
        /// <summary>
        /// 该接口将弃用 改用DeviceInfoChange()
        /// </summary>
        /// <param name="common">Common.</param>
        public void Changed(CommonDevice common)
        {
        }
        /// <summary>
        /// Changeds the IL ogic status.
        /// </summary>
        /// <param name="logic">Logic.</param>
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
        }
        /// <summary>
        /// Changeds the IS cene status.
        /// </summary>
        /// <param name="scene">Scene.</param>
        public void ChangedISceneStatus(Scene scene)
        {
        }
        /// <summary>
        /// 设备状态更新接口
        /// <para>type:如果为 DeviceInComingRespon:设备新上报</para>
@@ -1955,11 +1932,11 @@
                functionSceneBodyView.AddChidren(sceneScrolView);
                foreach (var scene in sceneList)
                {
                    var sceneView = new SceneCategoryView(0, 0);
                    var sceneView = new SceneCategoryView();
                    sceneScrolView.AddChidren(sceneView);
                    sceneView.Init(scene, room);
                    GetDelayScene(sceneScrolView);
                }
                    sceneView.InitControl(scene, room);
                }
                GetDelayScene(sceneScrolView);
            }
        }
@@ -2014,6 +1991,10 @@
            for (int i = 0; scrolViewLayout != null && i < scrolViewLayout.ChildrenCount; i++)
            {
                var sceneView = scrolViewLayout.GetChildren(i) as SceneCategoryView;
                if (sceneView == null)
                {
                    continue;
                }
                foreach (var delayScenesListResponseInfo in delayList)
                {
                    if (delayScenesListResponseInfo.ScenesId == sceneView.scene.Id)
@@ -2021,21 +2002,26 @@
                        sceneView.scene.RemainTime = delayScenesListResponseInfo.RemainTime;
                        var remainTime = delayScenesListResponseInfo.RemainTime;
                        if (remainTime > 0)
                        {
                        {
                            //开启内部延时时间线程(旨在全部地方的同一场景时间同步)
                            HdlSceneLogic.Current.StartDelayTimeThread(sceneView.scene);
                            new System.Threading.Thread(() =>
                            {
                                while (remainTime-- > 0)
                                while (remainTime > 0 && this.Parent != null)
                                {
                                    System.Threading.Thread.Sleep(1000);
                                    Application.RunOnMainThread(() =>
                                    {
                                        sceneView.SetTimeText(CommonFormResouce.GetTimeString(remainTime));
                                    });
                                    remainTime--;
                                }
                                Application.RunOnMainThread(() =>
                                {
                                    sceneView.scene.RemainTime = 0;
                                    sceneView.SetTimeImage();
                                    if (this.Parent != null)
                                    {
                                        sceneView.SetTimeImage();
                                    }
                                });
                            })
                            { IsBackground = true }.Start();
@@ -2044,31 +2030,19 @@
                    }
                }
            }
        }
        /// <summary>
        /// GetExecScene
        /// </summary>
        /// <param name="scrolViewLayout"></param>
        private void GetExecScene(VerticalScrolViewLayout scrolViewLayout)
        {
            new System.Threading.Thread(() =>
            {
            })
            { IsBackground = true }.Start();
        }
        }
        #endregion
        #region ◆ 自动化__________________________
        /// <summary>
        /// 自动化功能代码入口
        /// </summary>
        private  void ShowAutotion()
        private void ShowAutotion()
        {
           // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            // functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
            var bjFrameLayout = new FrameLayout
            {
                Width = Application.GetRealWidth(1080 - 58),
@@ -2226,25 +2200,25 @@
                }
                logicScrolView.Y = scenehorizontalScrol.Bottom + Yheight;
                logicScrolView.Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30) - Yheight;
                Automationview(logicScrolView,no);
                Automationview(logicScrolView, no);
            };
            logicScrolView.BeginHeaderRefreshingAction += () =>
            {
                //重新刷新logic列表
                Common.Logic.LogicList.Clear();
                Read(logicScrolView,no);
                Read(logicScrolView, no);
                //关闭刷新View;
                logicScrolView.EndHeaderRefreshing();
            };
            Read(logicScrolView,no);
            };
            Read(logicScrolView, no);
        }
        /// <summary>
        /// 读取自动化列表数据;
        /// </summary>
        /// <param name="logicScrolView"></param>
        private async void Read(VerticalRefreshLayout logicScrolView,bool no)
        private async void Read(VerticalRefreshLayout logicScrolView, bool no)
        {
            CommonPage.Loading.Start();
            if (Common.Logic.LogicList.Count == 0)
@@ -2266,23 +2240,23 @@
                }
            }
            //自动化
            Automationview(logicScrolView,no);
            Automationview(logicScrolView, no);
            CommonPage.Loading.Hide();
        }
        /// <summary>
        /// 加载自动化列表界面
        /// </summary>
        /// <param name="refresview">Refresview.</param>
        private async void Automationview(VerticalRefreshLayout refresview,bool no)
        private async void Automationview(VerticalRefreshLayout refresview, bool no)
        {
            refresview.RemoveAll();
            if (Common.Logic.LogicList.Count == 0&&no==false)
            if (Common.Logic.LogicList.Count == 0 && no == false)
            {
                //就是为了显示引导添加图标;
                refresview.BackgroundColor = 0x00000000;
                var noFrameLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(434+ 200+32+160),
                    Height = Application.GetRealHeight(434 + 200 + 32 + 160),
                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                refresview.AddChidren(noFrameLayout);
@@ -2290,7 +2264,7 @@
                var noIconBtn = new Button
                {
                    Y=Application.GetRealHeight(160),
                    Y = Application.GetRealHeight(160),
                    Width = Application.GetMinRealAverage(756),
                    Height = Application.GetMinRealAverage(434),
                    UnSelectedImagePath = "Item/NoFunction.png",
@@ -2301,14 +2275,14 @@
                var noTextBtn = new Button()
                {
                    Y = noIconBtn.Bottom,
                    Height = Application.GetRealHeight(200)+Application.GetRealHeight(32),
                    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),
                    X = Application.GetRealWidth(190 - 58),
                };
                noFrameLayout.AddChidren(noTextBtn);
@@ -2327,16 +2301,16 @@
                }
            }
            foreach (var logic in Common.Logic.LogicList)
            {
            {
                var logicRowlayout = new RowLayout
                {
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080-58),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                   BackgroundColor =ZigbeeColor.Current.LogicBackgroundColor,
                    Width = Application.GetRealWidth(1080 - 58),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
                refresview.AddChidren(logicRowlayout);
@@ -2411,9 +2385,9 @@
                    var logicCommunalPage = new Logic.LogicCommunalPage();
                    HomePage.Instance.AddChidren(logicCommunalPage);
                    HomePage.Instance.PageIndex += 1;
                    logicCommunalPage.Show(() => {
                    logicCommunalPage.Show(() => {
                        logicnameBtn.Text = logic.LogicName;
                        Automationview(refresview,no);
                        Automationview(refresview, no);
                    });
                };
@@ -2444,7 +2418,7 @@
                var line = new Button
                {
                    Y = Application.GetRealHeight(215),
                    Height = Application.GetRealHeight(5),
                    Height = Application.GetRealHeight(5),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                    X = Application.GetRealWidth(58),
@@ -2924,10 +2898,10 @@
            {
                commonDeviceList.Add(common);
            }
        }
        }
        #endregion
    }
}