WJC
2020-04-02 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7
ZigbeeApp/Shared/Phone/Device/Category/Category.cs
old mode 100755 new mode 100644
@@ -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>
@@ -812,14 +789,15 @@
        /// </summary>
        private void Add_Automation()
        {
            //new一个新逻辑对象;
            Common.Logic.CurrentLogic = new Common.Logic();
            Common.Logic.CurrentLogic.IsEnable = 1;//默认为开
            Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
            var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage();
            UserView.HomePage.Instance.AddChidren(addLogicPage);
            UserView.HomePage.Instance.PageIndex += 1;
            addLogicPage.Show();
            ////new一个新逻辑对象;
            //Common.Logic.CurrentLogic = new Common.Logic();
            //Common.Logic.CurrentLogic.IsEnable = 1;//默认为开
            //Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
            //var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage();
            //UserView.HomePage.Instance.AddChidren(addLogicPage);
            //UserView.HomePage.Instance.PageIndex += 1;
            //addLogicPage.Show();
            Shared.Phone.Device.Logic.SkipView.SkipAddLogic(0);
        }
        /// <summary>
        /// HidenFloor
@@ -1955,11 +1933,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 +1992,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 +2003,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 +2031,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 +2201,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 +2241,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 +2265,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 +2276,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);
@@ -2328,17 +2303,23 @@
            }
            foreach (var logic in Common.Logic.LogicList)
            {
                var fLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(190 + 30),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
                refresview.AddChidren(fLayout);
                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);
                fLayout.AddChidren(logicRowlayout);
@@ -2411,9 +2392,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);
                    });
                };
@@ -2443,13 +2424,13 @@
                };
                var line = new Button
                {
                    Y = Application.GetRealHeight(215),
                    Height = Application.GetRealHeight(5),
                    Y = fLayout.Height - 1,
                    Height = 1,
                    X = Application.GetRealWidth(58),
                    Width = Application.GetRealWidth(1080 - 58),
                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                    X = Application.GetRealWidth(58),
                };
                logicRowlayout.AddChidren(line);
                fLayout.AddChidren(line);
            }
        }
@@ -2924,10 +2905,10 @@
            {
                commonDeviceList.Add(common);
            }
        }
        }
        #endregion
    }
}