黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/Device/Logic/WeekPage.cs
@@ -15,86 +15,25 @@
  
        public void Show (string titlename)
        {
            var weeklist = new List<string> ();
            #region  最上面的布局代码
            var topRowLayout = new RowLayout
            {
                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
                Height = Application.GetRealHeight(184),
                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
            };
            this.AddChidren(topRowLayout);
            var titleName = new Button
            {
                TextSize = 16,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                Text = titlename,
            };
            topRowLayout.AddChidren(titleName);
            var clickBtn = new Button
            {
                Width = Application.GetRealWidth(81 + 51),
                Height = Application.GetRealHeight(58 + 40),
                Y = Application.GetRealHeight(98 - 40),
            };
            topRowLayout.AddChidren(clickBtn);
            clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            var back = new Button
            {
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealHeight(51),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(98),
                //Gravity = Gravity.CenterVertical;
                UnSelectedImagePath = "ZigeeLogic/back.png",
            };
            topRowLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) => {
                RemoveFromParent();
            };
            #endregion
            #region  界面的布局代码
            TopView view = new TopView();
            this.AddChidren(view.TopRowView());
            view.toptitleNameBtn.Text=titlename;
            view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
            var middle = new VerticalScrolViewLayout
            {
                Y = topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184-260),
                Y = view.topRowLayout.Bottom,
                Height = Application.GetRealHeight(Method.H - 184-260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
            LogicView.SaveView saveView = new LogicView.SaveView();
            saveView.frameLayout.Y = middle.Bottom;
            this.AddChidren(saveView.Show());
            #endregion
            var saveFramelayout = new FrameLayout
            {
                Y = middle.Bottom,
                Height = Application.GetRealHeight(260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(saveFramelayout);
            var saveBtn= new Button
            {
                X = Application.GetRealWidth(85),
                Height = Application.GetRealHeight(130),//194
                Width = Application.GetRealWidth(910),
                Radius = (uint)Application.GetRealHeight(60),
                BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
                TextID = MyInternationalizationString.Save,
                TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
            };
            saveFramelayout.AddChidren(saveBtn);
            var weeklist = new List<string>();
            if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 5)
            {
                string len = "";
@@ -142,7 +81,6 @@
                    }
                }
            }
            var cyclelist = new List<string> ();
            cyclelist.AddRange (new string [] {
                        Language.StringByID(MyInternationalizationString.mon),
@@ -156,67 +94,29 @@
            foreach (var name in cyclelist)
            {
                var weekFramelayout = new FrameLayout
                {
                    Height = Application.GetRealHeight(160),
                    BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                };
                middle.AddChidren(weekFramelayout);
                var weekIconBtn = new Button
                {
                    Width = Application.GetRealWidth(81),
                    Height = Application.GetRealHeight(81),
                    UnSelectedImagePath = "ZigeeLogic/point.png",
                    X = Application.GetRealWidth(58),
                    Y = Application.GetRealHeight(55),
                };
                weekFramelayout.AddChidren(weekIconBtn);
                var weekRow = new RowLayout
                {
                    Y = Application.GetRealHeight(30),
                    Width = Application.GetRealWidth(850),
                    Height = Application.GetRealHeight(130),
                    X = Application.GetRealWidth(176),
                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
                };
                weekFramelayout.AddChidren(weekRow);
                var weekTextBtn = new Button
                {
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = name,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                };
                weekRow.AddChidren(weekTextBtn);
                var selectedBtn = new Button
                {
                    X = Application.GetRealWidth(789),
                    Width = Application.GetMinRealAverage(60),
                    Height = Application.GetMinRealAverage(60),
                    UnSelectedImagePath = "ZigeeLogic/selected.png",
                    Gravity = Gravity.CenterVertical,
                    Visible = false,
                };
                weekRow.AddChidren(selectedBtn);
                FunView monView = new FunView();
                monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png";
                monView.funnameBtn.Text= name;
                monView.funnextBtn.Width = Application.GetMinRealAverage(60);
                monView.funnextBtn.Height = Application.GetMinRealAverage(60);
                monView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
                monView.funnextBtn.Visible = false;
                middle.AddChidren(monView.FunFrameView());
                if (Language.StringByID(MyInternationalizationString.sun) == name)
                {
                    weekRow.LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
                    monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度;
                    monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色
                }
                var str = weeklist.Find((o) => { return o == name; });
                if (str != null)
                {
                    selectedBtn.Visible = true;
                    monView.funnextBtn.Visible = true;
                }
                EventHandler<MouseEventArgs> weekclick = (sender, e) =>
                monView.clickviewBtn.MouseUpEventHandler+= (sender, e) =>
                {
                    selectedBtn.Visible = !selectedBtn.Visible;
                    if (selectedBtn.Visible)
                    monView.funnextBtn.Visible = !monView.funnextBtn.Visible;
                    if (monView.funnextBtn.Visible)
                    {
                        var d = weeklist.Find((o) => { return o == name; });
                        if (d == null)
@@ -233,16 +133,9 @@
                    }
                };
                weekFramelayout.MouseUpEventHandler += weekclick;
                weekTextBtn.MouseUpEventHandler += weekclick;
                selectedBtn.MouseUpEventHandler += weekclick;
                weekIconBtn.MouseUpEventHandler += weekclick;
                weekRow.MouseUpEventHandler += weekclick;
            }
            saveBtn.MouseUpEventHandler += (sender, e) =>
            saveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                int weekvalue = 0;
@@ -279,10 +172,9 @@
                }
                if (weekvalue == 0)
                {
                    var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
                                                      Language.StringByID(MyInternationalizationString.selectweek),
                                                  Language.StringByID(MyInternationalizationString.complete));
                    var alert = new ShowMsgControl(ShowMsgType.Normal,
                                   Language.StringByID(MyInternationalizationString.selectweek),
                                  Language.StringByID(MyInternationalizationString.confrim));
                    alert.Show();
                    return;
                }