gxc
2019-10-29 081ea8d273048fd03756718ac6fb48a3c09218e9
ZigbeeApp/Shared/Phone/Device/Logic/TimePage.cs
@@ -14,183 +14,256 @@
        {
            Tag = "Logic";
        }
        public bool IsDeviceEditor1;
        public bool IsEditor;
        public string str1;
        Dictionary<string, string> timeBucketConditionsInfo = new Dictionary<string, string>();
        public void Show()
        {
            this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
            this.AddChidren(new Button
            {
                Height = Application.GetRealHeight(80),
            });
            var topFrameLayout = new FrameLayout
            #region  最上面的布局代码
            var topRowLayout = new RowLayout
            {
                Height = Application.GetRealHeight(140),
                Y = Application.GetRealHeight(80),
                BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
                Height = Application.GetRealHeight(184),
                LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
            };
            AddChidren(topFrameLayout);
            this.AddChidren(topRowLayout);
            var titleName = new Button
            {
                Text = Language.StringByID(MyInternationalizationString.addtime),
                TextSize = 17,
                TextSize = 16,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                X = Application.GetRealWidth(150),
                X = Application.GetRealWidth(176),
                Width = Application.GetRealWidth(400),
                Height = Application.GetRealHeight(69),
                Y = Application.GetRealHeight(92),
                TextID = MyInternationalizationString.addtime,
            };
            topFrameLayout.AddChidren(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(110),
                Height = Application.GetRealHeight(110),
                X = Application.GetRealWidth(20),
                Gravity = Gravity.CenterVertical,
                UnSelectedImagePath = "ZigeeLogic/Back.png",
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealHeight(51),
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(98),
                //Gravity = Gravity.CenterVertical;
                UnSelectedImagePath = "ZigeeLogic/back.png",
            };
            topFrameLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) =>
            {
            topRowLayout.AddChidren(back);
            back.MouseDownEventHandler += (sender, e) => {
                RemoveFromParent();
                IsDeviceEditor1 = false;
            };
            #endregion
            var middle = new VerticalScrolViewLayout();
            middle.Y = topFrameLayout.Bottom;
            middle.Height = Application.GetRealHeight(1920- 220 - 200);
            middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
            #region  最下面的布局代码
            var middle = new FrameLayout
            {
                Y = topRowLayout.Bottom,
                Height = Application.GetRealHeight(1920 - 184-260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            this.AddChidren(middle);
            #region   -----立即执行
            var row = new RowLayout
            var fra = new FrameLayout
            {
                Height = Application.GetRealHeight(250),
                Y = middle.Bottom,
                Height = Application.GetRealHeight(260),
                BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
            };
            middle.AddChidren(row);
            var btnTextTitle = new Button
            this.AddChidren(fra);
            var btnsave = new Button
            {
                Height = Application.GetRealHeight(50),
                Width = Application.GetRealWidth(800),
                Y = Application.GetRealHeight(20),
                X = Application.GetRealWidth(40),
               // Text = "请选择时间类型",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextID = MyInternationalizationString.Selectedtimetype,
                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,
            };
            row.AddChidren(btnTextTitle);
            fra.AddChidren(btnsave);
            #endregion
            #region   -----时间范围  开始时间  结束时间
            #region   -----时间范围
            var typeFramelayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            };
            middle.AddChidren(typeFramelayout);
            var typeRowlayout = new RowLayout
            {
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(58),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            typeFramelayout.AddChidren(typeRowlayout);
            var btnTypeTextTitle = new Button
            {
                Y = Application.GetRealHeight(20 + 50),
               // Text = "类型",
                X = Application.GetRealWidth(40),
                Text = Language.StringByID(MyInternationalizationString.type),
                TextAlignment = TextAlignment.CenterLeft,
                Height = Application.GetRealHeight(180),
                Width = Application.GetRealWidth(400),
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextID = MyInternationalizationString.type,
                Width = Application.GetRealWidth(265)
            };
            row.AddChidren(btnTypeTextTitle);
            var btnTypeText = new Button
            typeRowlayout.AddChidren(btnTypeTextTitle);
            var btnimmediateexecution = new Button
            {
                Y = Application.GetRealHeight(20 + 50),
                X = Application.GetRealWidth(1080 - 500 - 40),
                //Text = "时间范围",
                X = btnTypeTextTitle.Right,
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(630),
                TextAlignment = TextAlignment.CenterRight,
                Height = Application.GetRealHeight(180),
                Width = Application.GetRealWidth(500),
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                TextID = MyInternationalizationString.timeframe,
            };
            row.AddChidren(btnTypeText);
            typeRowlayout.AddChidren(btnimmediateexecution);
            var btnimmediateexecutionBack = new Button
            {
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealHeight(58),
                UnSelectedImagePath = "ZigeeLogic/next.png",
                X = btnimmediateexecution.Right + Application.GetRealWidth(12),
                Gravity = Gravity.CenterVertical,
            };
            typeRowlayout.AddChidren(btnimmediateexecutionBack);
            #endregion
            #region  -----开始时间
            var timestarFramelayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                Y= typeFramelayout.Bottom,
            };
            middle.AddChidren(timestarFramelayout);
            var timestartrow = new RowLayout
            {
                Height = Application.GetRealHeight(180),
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(58),
                LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
            };
            middle.AddChidren(timestartrow);
            timestarFramelayout.AddChidren(timestartrow);
            var btnstarttimetext = new Button
            {
                Text = Language.StringByID(MyInternationalizationString.starttime),
                TextAlignment = TextAlignment.CenterLeft,
                Width = Application.GetRealWidth(300),
                X = Application.GetRealWidth(30),
                TextID = MyInternationalizationString.starttime,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                Width = Application.GetRealWidth(265)
            };
            timestartrow.AddChidren(btnstarttimetext);
            var btnstarttime = new Button
            {
                X = Application.GetRealWidth(330),
                X = btnstarttimetext.Right,
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(600),
                TextAlignment = TextAlignment.CenterLeft,
                Tag = "0",
                Width = Application.GetRealWidth(630),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                Tag = "0",
            };
            timestartrow.AddChidren(btnstarttime);
            var btnstartback = new Button
            {
                Width = Application.GetRealWidth(110),
                Height = Application.GetRealHeight(110),
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealHeight(58),
                UnSelectedImagePath = "ZigeeLogic/next.png",
                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
                X = Application.GetRealWidth(1080-140),
                X = btnstarttime.Right + Application.GetRealWidth(12),
                Gravity = Gravity.CenterVertical,
            };
            timestartrow.AddChidren(btnstartback);
            #endregion
            #region  -----结束时间
            var timeendFramelayout = new FrameLayout
            {
                Height = Application.GetRealHeight(160),
                BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                Y = timestarFramelayout.Bottom,
            };
            middle.AddChidren(timeendFramelayout);
            var timeendrow = new RowLayout
            {
                Height = Application.GetRealHeight(180),
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(130),
                X = Application.GetRealWidth(58),
                LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
            };
            middle.AddChidren(timeendrow);
            timeendFramelayout.AddChidren(timeendrow);
            var btnendtimetext = new Button
            {
                Text = Language.StringByID(MyInternationalizationString.endtime),
                TextAlignment = TextAlignment.CenterLeft,
                Width = Application.GetRealWidth(300),
                X = Application.GetRealWidth(30),
                TextID = MyInternationalizationString.endtime,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                Width = Application.GetRealWidth(265),
            };
            timeendrow.AddChidren(btnendtimetext);
            var btnendtime = new Button
            {
                X = Application.GetRealWidth(330),
                X = btnendtimetext.Right,
                Gravity = Gravity.CenterVertical,
                Width = Application.GetRealWidth(600),
                TextAlignment = TextAlignment.CenterLeft,
                Tag = "0",
                Width = Application.GetRealWidth(630),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                Tag = "0",
            };
            timeendrow.AddChidren(btnendtime);
            var btnendtimeback = new Button
            {
                Width = Application.GetRealWidth(110),
                Height = Application.GetRealHeight(110),
                Width = Application.GetRealWidth(58),
                Height = Application.GetRealHeight(58),
                UnSelectedImagePath = "ZigeeLogic/next.png",
                SelectedImagePath = "ZigeeLogic/NextSelecte.png",
                X = Application.GetRealWidth(1080-140),
                X = btnendtime.Right + Application.GetRealWidth(12),
                Gravity = Gravity.CenterVertical,
            };
            timeendrow.AddChidren(btnendtimeback);
            #endregion
            #endregion
            if (IsDeviceEditor1)
            if (IsEditor)
            {
                if (str1 != null)
                {
@@ -245,11 +318,10 @@
                }
            }
            EventHandler<MouseEventArgs> stattimeclick = (sender, e) =>
            {
                var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
                AddChidren(flMain);
                flMain.MouseUpEventHandler += (sender11, e11) =>
                {
@@ -319,11 +391,11 @@
            btnstarttimetext.MouseUpEventHandler += stattimeclick;
            btnstarttime.MouseUpEventHandler += stattimeclick;
            btnstartback.MouseUpEventHandler += stattimeclick;
            timestarFramelayout.MouseUpEventHandler += stattimeclick;
            EventHandler<MouseEventArgs> endtimeclick = (sender, e) =>
            {
                var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
                AddChidren(flMain);
                flMain.MouseUpEventHandler += (sender11, e11) =>
                {
@@ -394,30 +466,14 @@
            btnendtimetext.MouseUpEventHandler += endtimeclick;
            btnendtime.MouseUpEventHandler += endtimeclick;
            btnendtimeback.MouseUpEventHandler += endtimeclick;
            timeendFramelayout.MouseUpEventHandler += endtimeclick;
            var fra = new FrameLayout
            {
                Y = middle.Bottom,
                Height = Application.GetRealHeight(200),
                BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
            };
            this.AddChidren(fra);
            var btncomplete = new Button
            {
                X = Application.GetRealWidth(290),
                Height = Application.GetRealHeight(150),//194
                Width = Application.GetRealWidth(500),
                Radius = (uint)Application.GetRealHeight(50),
                BackgroundColor = ZigbeeColor.Current.LogicButtonBlueColor,
                TextID = MyInternationalizationString.Save,
            };
            fra.AddChidren(btncomplete);
            timeBucketConditionsInfo.Add("Type","5");
            timeBucketConditionsInfo.Add("IsValid", "1");
            ///完成点击事件
            EventHandler<MouseEventArgs>completeclick=(sender, e) =>
            {
                timeBucketConditionsInfo.Add("Type", "5");
                timeBucketConditionsInfo.Add("IsValid", "1");
                if (string.IsNullOrEmpty(btnstarttime.Text) || string.IsNullOrEmpty(btnendtime.Text))
                {
@@ -436,7 +492,7 @@
                    return;
                }
                if (IsDeviceEditor1)
                if (IsEditor)
                {
                    for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++)
                    {
@@ -466,9 +522,8 @@
                UserView.HomePage.Instance.PageIndex += 1;
                logicCommunalPage.Show(() => { });
            };
            fra.MouseUpEventHandler += completeclick;
            btncomplete.MouseUpEventHandler += completeclick;
            btnsave.MouseUpEventHandler += completeclick;
        }
    }