WJC
2019-12-30 f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicList.cs
@@ -12,8 +12,8 @@
        {
            Tag = "LockLogicList";
        }
        VerticalScrolViewLayout middle;
        public async void Show()
        VerticalRefreshLayout middle;
        public void Show()
        {
            #region  最上面的布局代码
@@ -27,14 +27,15 @@
            var titleName = new Button
            {
                TextSize = 16,
                TextSize = 17,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(400),
                Width = Application.GetRealWidth(600),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                TextID = MyInternationalizationString.selection,
                TextID = MyInternationalizationString.linkageevent,
                IsBold = true,
            };
            topRowLayout.AddChidren(titleName);
@@ -80,10 +81,7 @@
                Common.Logic.CurrentLogic = new Common.Logic();
                Common.Logic.CurrentLogic.IsEnable = 1;//默认为开
                Common.Logic.CurrentLogic.LogicType = 1;
                //Config.Instance.Guid用来识别账号身份;
                var accounts = new System.Collections.Generic.Dictionary<string, string>();
                accounts.Add("Account", Config.Instance.Guid);
                Common.Logic.CurrentLogic.Accounts.Add(accounts);
                Common.Logic.CurrentLogic.Relationship = 1;
                Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1);
                var lockLogicCommunalPage = new LockLogicCommunalPage();
                UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
@@ -92,14 +90,29 @@
            };
            #endregion
            middle = new VerticalScrolViewLayout
            middle = new VerticalRefreshLayout
            {
                Y = topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
            middle.BeginHeaderRefreshingAction += () =>
            {
                //重新刷新logic列表
                Common.Logic.LockLogicList.Clear();
                Read();
                //关闭刷新View;
                middle.EndHeaderRefreshing();
            };
            Read();
        }
        /// <summary>
        /// 读取自动化数据
        /// </summary>
        public async void Read()
        {
            CommonPage.Loading.Start();
            if (Common.Logic.LockLogicList.Count == 0)
            {
@@ -132,14 +145,52 @@
                    }
                }
            }
            //自动化
            Automationview();
            CommonPage.Loading.Hide();
        }
        void Automationview()
        /// <summary>
        /// 加载自动化列表的界面
        /// </summary>
        public void Automationview()
        {
            middle.RemoveAll();
            if (Common.Logic.LockLogicList.Count == 0)
            {
                //就是为了显示引导添加图标;
                var noFrameLayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(434 + 200 + 32 + 320),
                    //BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                };
                middle.AddChidren(noFrameLayout);
                var noIconBtn = new Button
                {
                    Y = Application.GetRealHeight(320),
                    Width = Application.GetMinRealAverage(756),
                    Height = Application.GetMinRealAverage(434),
                    UnSelectedImagePath = "Item/NoFunction.png",
                    X = Application.GetRealWidth(162),
                };
                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),
                };
                noFrameLayout.AddChidren(noTextBtn);
            }
            for (int i = 0; i < Common.Logic.LockLogicList.Count; i++)
            {
                var logic = Common.Logic.LockLogicList[i];
@@ -147,7 +198,7 @@
                {
                    Width = Application.GetRealWidth(1080),
                    Height = Application.GetRealHeight(190),
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                };
@@ -162,6 +213,7 @@
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    Gravity = Gravity.CenterVertical,
                    TextSize = 15,
                };
                logicRowlayout.AddChidren(logicnameBtn);
@@ -190,9 +242,17 @@
                        //逻辑关
                        logic.IsEnable = 0;
                    }
                    Logic.Send.LogicControlSwitch(logic);
                    Send.LogicControlSwitch(logic);
                };
                if (logic.IsEnable == 1)
                {
                    logicswitchBtn.IsSelected = true;
                }
                else if (logic.IsEnable == 0)
                {
                    logicswitchBtn.IsSelected = false;
                }
                ///编辑
                var edit = new Button
                {
@@ -228,7 +288,7 @@
                    {
                        if (e1)
                        {
                            Common.Logic.LogicList.Remove(logic);
                            Common.Logic.LockLogicList.Remove(logic);
                            Automationview();
                            Send.DelLogic(logic.LogicId);
                        }