From 081ea8d273048fd03756718ac6fb48a3c09218e9 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 29 十月 2019 13:10:00 +0800 Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC --- ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs | 422 ++++++++++++++++++++++------------------------------ 1 files changed, 182 insertions(+), 240 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs index b5394a8..27e264e 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/EverymonthPage.cs @@ -1,4 +1,7 @@ -锘縰sing System; +锘� + + +using System; using System.Collections.Generic; using Shared; using Shared.Phone; @@ -6,266 +9,104 @@ using Shared.Common; namespace Shared.Phone.Device.Logic { + public class EverymonthPage : FrameLayout { - - - public void Show() + public EverymonthPage() { - - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - var topFrameLayout = new FrameLayout + Tag = "Logic"; + } + public void Show(string titlename) + { + #region 鏈�涓婇潰鐨勫竷灞�浠g爜 + 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 { - TextID = MyInternationalizationString.cycle, - TextSize = 17, - TextColor=ZigbeeColor.Current.LogicTextBlackColor, + 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, }; - topFrameLayout.AddChidren(titleName); + topRowLayout.AddChidren(titleName); - var hdl = new Button + var clickBtn = new Button { - Width = Application.GetRealWidth(154), - Height = Application.GetRealHeight(90), - X = Application.GetRealWidth(1080-170), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "Logo/Logo.png", + Width = Application.GetRealWidth(81 + 51), + Height = Application.GetRealHeight(58 + 40), + Y = Application.GetRealHeight(98 - 40), }; - //topFrameLayout.AddChidren(hdl); - - var back = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - X = Application.GetRealWidth(20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", - }; - topFrameLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => + topRowLayout.AddChidren(clickBtn); + clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; - var titlerl = new RowLayout + var back = new Button { - Height = Application.GetRealHeight(180), - //BackgroundColor = 0xff0f0f0f, - Y = Application.GetRealHeight(220), + Width = Application.GetRealWidth(30), + Height = Application.GetRealHeight(51), + X = Application.GetRealWidth(81), + Y = Application.GetRealHeight(98), + //Gravity = Gravity.CenterVertical; + UnSelectedImagePath = "ZigeeLogic/back.png", }; - AddChidren(titlerl); + topRowLayout.AddChidren(back); + back.MouseDownEventHandler += (sender, e) => { + RemoveFromParent(); + }; + #endregion - titlerl.AddChidren( - new Button - { - X = Application.GetRealWidth(40), - //Text = "璇烽�夋嫨閲嶅鎵ц鍛ㄦ湡", - TextID = MyInternationalizationString.repeat, - TextSize = 17, - TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - } - ); - - var middle = new VerticalScrolViewLayout(); - middle.Y = titlerl.Bottom; - middle.Height = Application.GetRealHeight(1920 - 220 - 180); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + var middle = new FrameLayout + { + Y = topRowLayout.Bottom, + Height = Application.GetRealHeight(1920 - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; this.AddChidren(middle); - var startdaterow = new RowLayout + var frameLayout = new FrameLayout { - Height = Application.GetRealHeight(180), + Y = Application.GetRealHeight(80), + X = Application.GetRealWidth(50), + Width = Application.GetRealWidth(1080 - 100), + Height = Application.GetRealHeight(180 * 5 + 50), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, }; - middle.AddChidren(startdaterow); - - var btnstartdatetext = new Button + middle.AddChidren(frameLayout); + + + var saveBtn = new Button { - TextAlignment = TextAlignment.CenterLeft, - Width = Application.GetRealWidth(300), - X = Application.GetRealWidth(30), - TextID = MyInternationalizationString.startdate, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, + Y = middle.Height - Application.GetRealHeight(260), + 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, }; - startdaterow.AddChidren(btnstartdatetext); + middle.AddChidren(saveBtn); - var btnstartdate = new Button + var monselectedlist = new List<string>(); + monselectedlist.Clear(); + if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 3) { - X = Application.GetRealWidth(330), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - Tag = "0", - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - startdaterow.AddChidren(btnstartdate); - - var btnstartback = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140), - Gravity = Gravity.CenterVertical, - }; - startdaterow.AddChidren(btnstartback); - - var enddaterow = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(enddaterow); - var btnenddatetext = new Button - { - TextAlignment = TextAlignment.CenterLeft, - Width = Application.GetRealWidth(300), - X = Application.GetRealWidth(30), - TextID = MyInternationalizationString.enddate, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - enddaterow.AddChidren(btnenddatetext); - - var btnenddate = new Button - { - X = Application.GetRealWidth(330), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterLeft, - Tag = "0", - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - enddaterow.AddChidren(btnenddate); - - var btnendtimeback = new Button - { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - UnSelectedImagePath = "ZigeeLogic/next.png", - SelectedImagePath = "ZigeeLogic/NextSelecte.png", - X = Application.GetRealWidth(1080 - 140), - Gravity=Gravity.CenterVertical, - }; - enddaterow.AddChidren(btnendtimeback); - - - EventHandler<MouseEventArgs> startdateclick = (sender33, e33) => - { - var list = new List<string> { }; - for (int day = 1; day <= 31; day++) - { - list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day)); - } - //PickerView.Show(list, (obj) => - //{ - // var day = obj.Split(' ')[0]; - // if (btnenddate.Tag.ToString() != "0" && int.Parse(btnenddate.Tag.ToString()) < int.Parse(day)) - // { - // var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), - // Language.StringByID(MyInternationalizationString.monthday), - // Language.StringByID(MyInternationalizationString.OK)); - // alert.Show(); - // } - // else - // { - // btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day); - // btnstartdate.Tag = day; - // if (string.IsNullOrEmpty(btnenddate.Text)) - // { - // btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day); - // btnenddate.Tag = day; - // } - // Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3; - // int a = int.Parse(btnstartdate.Tag.ToString()); - // int b = int.Parse(btnenddate.Tag.ToString()); - // string s = ""; - // for (int i = 32; i > 0; i--) - // { - // if (i >=a && i <= b) - // { - // s += "1"; - // } - // else - // { - // s += "0"; - // } - // } - // var intvalue = Convert.ToInt32(s, 2); - // Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue; - // } - //}, Language.StringByID(MyInternationalizationString.complete), "112"); - }; - startdaterow.MouseUpEventHandler += startdateclick; - btnstartdate.MouseUpEventHandler += startdateclick; - btnstartdatetext.MouseUpEventHandler += startdateclick; - btnstartback.MouseUpEventHandler += startdateclick; - - - EventHandler<MouseEventArgs> enddateclick = (sender33, e33) => - { - var list = new List<string> { }; - for (int day = 1; day <= 31; day++) - { - list.Add(day.ToString() + " " + Language.StringByID(MyInternationalizationString.day)); - } - //PickerView.Show(list, (obj) => - //{ - // var day = obj.Split(' ')[0]; - // if (btnstartdate.Tag.ToString() != "0" && int.Parse(btnstartdate.Tag.ToString()) > int.Parse(day)) - // { - // var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), - // Language.StringByID(MyInternationalizationString.monthday), - // Language.StringByID(MyInternationalizationString.OK)); - // alert.Show(); - // } - // else - // { - // btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day); - // btnenddate.Tag = day; - // if (string.IsNullOrEmpty(btnstartdate.Text)) - // { - // btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + day + Language.StringByID(MyInternationalizationString.day); - // btnstartdate.Tag = day; - // } - - // Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3; - // int a = int.Parse(btnstartdate.Tag.ToString()); - // int b = int.Parse(btnenddate.Tag.ToString()); - // string s = ""; - // for (int i = 32; i > 0; i--) - // { - // if (i >= a && i <= b) - // { - // s += "1"; - // } - // else - // { - // s += "0"; - // } - // } - // var intvalue = Convert.ToInt32(s, 2); - // Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue; - - // } - //}, Language.StringByID(MyInternationalizationString.complete), "112"); - }; - enddaterow.MouseUpEventHandler += enddateclick; - btnenddate.MouseUpEventHandler += enddateclick; - btnenddatetext.MouseUpEventHandler += enddateclick; - btnendtimeback.MouseUpEventHandler += enddateclick; - - if(Common.Logic.CurrentLogic.TimeAttribute.Repeat==3){ if (Common.Logic.CurrentLogic.TimeAttribute.MonthDate != 0) { string len = ""; - int minvalue = 0; var maxvalue = Convert.ToString(Common.Logic.CurrentLogic.TimeAttribute.MonthDate, 2); var str = maxvalue.Insert(0, new string('0', 32 - maxvalue.Length)); for (int j = 31; j >= 0; j--) @@ -278,20 +119,121 @@ var strvalue = len.Substring(j, 1); if (strvalue == "1") { - minvalue = j + 1; - break; + monselectedlist.Add((j + 1).ToString()); } } - btnstartdate.Text = Language.StringByID(MyInternationalizationString.monthly) + minvalue.ToString() + Language.StringByID(MyInternationalizationString.day); - btnstartdate.Tag = minvalue.ToString(); - btnenddate.Text = Language.StringByID(MyInternationalizationString.monthly) + maxvalue.Length.ToString() + Language.StringByID(MyInternationalizationString.day); - btnenddate.Tag = maxvalue.Length.ToString(); - - } } + + + int k = 1; + for (int i = 0; i < 5; i++) + { + var timeRow = new RowLayout + { + Height = Application.GetRealHeight(180), + Y = Application.GetRealHeight(180 * i), + LineColor = ZigbeeColor.Current.LogicBackgroundColor, + }; + frameLayout.AddChidren(timeRow); + for (int j = 1; j < 8; j++) + { + if (k > 31) + { + continue; + } + + var monBtn = new Button + { + + Text = k.ToString().Length == 1 ? "0" + k.ToString() : k.ToString(), + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(100), + Width = Application.GetRealWidth(100), + X = Application.GetRealWidth(35 * j) + Application.GetRealWidth(100 * (j - 1)), + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + Radius = (uint)Application.GetRealHeight(50), + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, + SelectedBackgroundColor = ZigbeeColor.Current.LogicAddColor, + Tag = k, + }; + timeRow.AddChidren(monBtn); + + + + if (monselectedlist.Contains(k.ToString())) + { + monBtn.IsSelected = true; + } + k++; + + monBtn.MouseDownEventHandler += (sender, e) => + { + monBtn.IsSelected = !monBtn.IsSelected; + var selectedmon = monselectedlist.Find((c) => { return c == monBtn.Tag.ToString(); }); + if (monBtn.IsSelected) + { + if (selectedmon == null) + { + monselectedlist.Add(monBtn.Tag.ToString()); + + } + + } + else + { + if (selectedmon != null) + { + monselectedlist.Remove(monBtn.Tag.ToString()); + } + } + }; + } + } + + + + saveBtn.MouseUpEventHandler += (sedder, e) => + { + + if (monselectedlist.Count == 0) + { + var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), + Language.StringByID(MyInternationalizationString.selectweek), + Language.StringByID(MyInternationalizationString.complete)); + + alert.Show(); + return; + } + string s = ""; + for (int i = 32; i > 0; i--) + { + var selectedmon = monselectedlist.Find((a) => { return a == i.ToString(); }); + if (selectedmon != null) + { + s += "1"; + } + else + { + s += "0"; + } + + } + var intvalue = Convert.ToInt32(s, 2); + Common.Logic.CurrentLogic.TimeAttribute.Repeat = 3; + Common.Logic.CurrentLogic.TimeAttribute.MonthDate = intvalue; + + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + + }; + + + } } - -} +} \ No newline at end of file -- Gitblit v1.8.0