From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 02 九月 2020 17:35:03 +0800 Subject: [PATCH] 2020-09-02-4 --- ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs | 794 +++++++++++++++++++------------------------------------- 1 files changed, 271 insertions(+), 523 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs old mode 100644 new mode 100755 index 738a676..877bc00 --- a/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/TimePoint.cs @@ -3,6 +3,7 @@ using Shared; using Shared.Common; using Shared.Phone; +using Shared.Phone.Device.Logic.LogicView; using Shared.R; using ZigBee.Device; namespace Shared.Phone.Device.Logic @@ -13,92 +14,78 @@ { Tag = "Logic"; } - public bool IsDeviceEditor; - Dictionary<string, string> timeifon=new Dictionary<string, string>(); - Button beforeClickButton = new Button(); + Dictionary<string, string> timeifon = new Dictionary<string, string>(); TimeView timeview = new TimeView { - Height = Application.GetRealHeight(600), - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, + + Height = Application.GetRealHeight(550), + BackgroundColor =0x40ffffff,// ZigbeeColor.Current.LogicTopViewBackgroundColor, Width = Application.GetRealWidth(1080), }; + /// <summary> + /// 鏍囪(鏂板姞/杩涙潵缂栬緫) + /// </summary> + public bool IsEditor; + /// <summary> + /// 璁板綍杩涙潵涔嬪墠鐨勫垎閽� + /// </summary> public string StartMin; + /// <summary> + /// 璁板綍杩涙潵涔嬪墠鐨勫皬鏃� + /// </summary> public string StartHour; + /// <summary> + /// 璁板綍杩涙潵涔嬪墠鐨勬椂闂�(寤舵椂/鎻愬墠) + /// </summary> public string AdjustTime; + /// <summary> + /// 璁板綍鏃跺埢鐨勭被鍨�(鏃ュ嚭/鏃ヨ惤/姝e父) + /// </summary> public string DateType; public void Show(Dictionary<string, string> dictionary) { - + int TypeValue = int.Parse(dictionary["DateType"]); - timeifon.Add("Type", "0"); - timeifon.Add("IsValid", "1"); - timeifon.Add("RemindTime", "0"); - timeifon.Add("EnDelay", "0"); - timeifon.Add("DelayTime", "0"); - timeifon.Add("DateType", TypeValue.ToString()); - DateType = dictionary["DateType"]; - + timeifon.Add("Type", "0"); + timeifon.Add("IsValid", "1"); + timeifon.Add("RemindTime", "0"); + timeifon.Add("EnDelay", "0"); + timeifon.Add("DelayTime", "0"); + timeifon.Add("DoorLockOpenDelayTime","0"); + timeifon.Add("DateType", TypeValue.ToString()); + DateType = dictionary["DateType"]; + if (TypeValue == 0) { timeifon.Add("StartHour", dictionary["StartHour"]); timeifon.Add("StartMin", dictionary["StartMin"]); StartHour = dictionary["StartHour"]; - StartMin= dictionary["StartMin"]; + StartMin = dictionary["StartMin"]; } else { timeifon.Add("AdjustTime", dictionary["AdjustTime"]); AdjustTime = dictionary["AdjustTime"]; - } - - - this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; - this.AddChidren(new Button - { - Height = Application.GetRealHeight(80), - }); + } - var topFrameLayout = new FrameLayout - { - Height = Application.GetRealHeight(140), - Y = Application.GetRealHeight(80), - }; - AddChidren(topFrameLayout); + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.addtime; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + #endregion - var titleName = new Button - { - Text = Language.StringByID(MyInternationalizationString.addtime), - TextSize = 17, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment = TextAlignment.CenterLeft, - X = Application.GetRealWidth(150), - }; - topFrameLayout.AddChidren(titleName); - var back = new Button + var middle = new FrameLayout { - Width = Application.GetRealWidth(110), - Height = Application.GetRealHeight(110), - X = Application.GetRealWidth(20), - Gravity = Gravity.CenterVertical, - UnSelectedImagePath = "ZigeeLogic/Back.png", + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(Method.H - 184 - 260), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; - topFrameLayout.AddChidren(back); - back.MouseDownEventHandler += (sender, e) => - { - RemoveFromParent(); - IsDeviceEditor = false; - }; - - var middle = new VerticalScrolViewLayout(); - middle.Y = topFrameLayout.Bottom; - middle.Height = Application.GetRealHeight(1920 - 220 - 200); - middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; this.AddChidren(middle); + SelectedTimeTypeView(middle, TypeValue); - SelectedTimeTypeView(middle,TypeValue); - } /// <summary> @@ -106,105 +93,26 @@ /// </summary> /// <param name="middle">Middle.</param> /// <param name="TypeValue">Type value.</param> - void SelectedTimeTypeView(VerticalScrolViewLayout middle, int TypeValue) + void SelectedTimeTypeView(FrameLayout middle, int TypeValue) { middle.RemoveAll(); - #region -----绔嬪嵆鎵ц - var row = new RowLayout - { - Height = Application.GetRealHeight(250), - }; - middle.AddChidren(row); - - var btnTextTitle = 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, - }; - row.AddChidren(btnTextTitle); - - var btnTypeTextTitle = new Button - { - Y = Application.GetRealHeight(20 + 50), - //Text = "绫诲瀷", - TextID = MyInternationalizationString.type, - X = Application.GetRealWidth(40), - TextAlignment = TextAlignment.CenterLeft, - Height = Application.GetRealHeight(180), - Width = Application.GetRealWidth(400), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - row.AddChidren(btnTypeTextTitle); - - var btnTypeText = new Button - { - Y = Application.GetRealHeight(20 + 50), - X = Application.GetRealWidth(1080 - 500 - 40), - //Text = "绔嬪嵆鎵ц", - TextID = MyInternationalizationString.immediateexecution, - TextAlignment = TextAlignment.CenterRight, - Height = Application.GetRealHeight(180), - Width = Application.GetRealWidth(500), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - row.AddChidren(btnTypeText); - #endregion - - #region -----鏃跺埢 - var rowSelectedTimeType = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(rowSelectedTimeType); - - var btnTimeText = new Button - { - //Text = "鏃跺埢", - TextID = MyInternationalizationString.moment, - TextAlignment = TextAlignment.CenterLeft, - Width = Application.GetRealWidth(150), - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - rowSelectedTimeType.AddChidren(btnTimeText); + #region -----绫诲瀷 鏃跺埢 + TypeView typeView = new TypeView(); + middle.AddChidren(typeView.Show()); + typeView.textBtn.TextID = MyInternationalizationString.type; + typeView.titleBtn.Width = Application.GetRealWidth(630 + 70); + typeView.titleBtn.TextID = MyInternationalizationString.immediateexecution; + typeView.backBtn.Visible = false; - ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠� - var btnTimeTpye = new Button - { - X = Application.GetRealWidth(300), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - rowSelectedTimeType.AddChidren(btnTimeTpye); - - var btnTimeTpyeBack = 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, - }; - rowSelectedTimeType.AddChidren(btnTimeTpyeBack); - EventHandler<MouseEventArgs> timetpyeclick = (sedner, e) => - { + TypeView skView = new TypeView(); + skView.frameLayout.Y = typeView.frameLayout.Bottom; + middle.AddChidren(skView.Show()); + skView.textBtn.TextID = MyInternationalizationString.moment; + skView.clickviewBtn.MouseUpEventHandler += (sender, e) => { TimeTypeView(middle, TypeValue); - }; - rowSelectedTimeType.MouseUpEventHandler += timetpyeclick; - btnTimeText.MouseUpEventHandler += timetpyeclick; - btnTimeTpye.MouseUpEventHandler += timetpyeclick; - btnTimeTpyeBack.MouseUpEventHandler += timetpyeclick; + }; #endregion string textvalue = ""; @@ -212,13 +120,13 @@ { case 0: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.logiccustom); + skView.titleBtn.Text = Language.StringByID(MyInternationalizationString.logiccustom); textvalue = timeifon["StartHour"] + ":" + timeifon["StartMin"]; } break; case 1: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunrise); + skView.titleBtn.Text = Language.StringByID(MyInternationalizationString.sunrise); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -229,13 +137,13 @@ } else { - textvalue =Language.StringByID(MyInternationalizationString.nothing); + textvalue = Language.StringByID(MyInternationalizationString.nothing); } } break; case 2: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.sunset); + skView.titleBtn.Text = Language.StringByID(MyInternationalizationString.sunset); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -246,13 +154,13 @@ } else { - textvalue =Language.StringByID(MyInternationalizationString.nothing); + textvalue = Language.StringByID(MyInternationalizationString.nothing); } } break; case 3: { - btnTimeTpye.Text = Language.StringByID(MyInternationalizationString.noon); + skView.titleBtn.Text = Language.StringByID(MyInternationalizationString.noon); if (int.Parse(timeifon["AdjustTime"]) > 0) { textvalue = Language.StringByID(MyInternationalizationString.delayed) + timeifon["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute); @@ -268,17 +176,17 @@ } break; } - if (TypeValue == 0) { #region -----鑷畾涔夋椂闂� - var rowTimeView = new RowLayout + skView.backBtn.UnSelectedImagePath = "ZigeeLogic/dropdown.png"; + var rowTimeView = new FrameLayout { + Y = skView.frameLayout.Bottom, Height = Application.GetRealHeight(600), }; middle.AddChidren(rowTimeView); - rowTimeView.AddChidren(timeview); #endregion } @@ -286,77 +194,101 @@ { #region -----鎻愬墠/寤舵椂 - var rowDelayType = new RowLayout - { - Height = Application.GetRealHeight(180), - }; - middle.AddChidren(rowDelayType); - var btnDelayTimeText = new Button - { - //Text = "鎻愬墠/寤舵椂", - TextID = MyInternationalizationString.Advancedelay, - TextAlignment = TextAlignment.CenterLeft, - Width = Application.GetRealWidth(250), - X = Application.GetRealWidth(40), - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - }; - rowDelayType.AddChidren(btnDelayTimeText); - ///鏄剧ず鏃堕棿绫诲瀷鐨勬帶浠� - var btnDelayTime = new Button - { - X = Application.GetRealWidth(300), - Gravity = Gravity.CenterVertical, - Width = Application.GetRealWidth(600), - TextAlignment = TextAlignment.CenterRight, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Text = textvalue, - }; - rowDelayType.AddChidren(btnDelayTime); + TypeView delayView = new TypeView(); + delayView.frameLayout.Y = skView.frameLayout.Bottom; + delayView.frameLayout.Height = Application.GetRealHeight(160+20);//澧為珮鏈�鍚庝竴琛岀殑楂樺害20; + middle.AddChidren(delayView.Show()); + delayView.textBtn.TextID = MyInternationalizationString.Advancedelay; + delayView.titleBtn.Text = textvalue; + delayView.lineBtn.BackgroundColor = BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + delayView.clickviewBtn.MouseUpEventHandler += (sender, e) => { + var mList = new List<string>(); + mList.Add(Language.StringByID(MyInternationalizationString.advance)); + mList.Add(Language.StringByID(MyInternationalizationString.nothing)); + mList.Add(Language.StringByID(MyInternationalizationString.delayed)); + var listValues = new List<string>(); + for (int i = 1; i < 61; i++) + { + if (i < 10) + { + var a = "0" + i.ToString(); + listValues.Add(a + " " + Language.StringByID(MyInternationalizationString.minute)); + } + else + { + listValues.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute)); + } - var btnDelayTimeBack = 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, - }; - rowDelayType.AddChidren(btnDelayTimeBack); + } + var mList2 = new List<List<string>>(); + mList2.Add(listValues); + mList2.Add(new List<string> { "0" }); + mList2.Add(listValues); + int timevalue = 0; + int selectIndex = 1; + if (int.Parse(timeifon["AdjustTime"]) > 0) + { + selectIndex = 2; + timevalue = Math.Abs(int.Parse(timeifon["AdjustTime"])); + } + else if (int.Parse(timeifon["AdjustTime"]) < 0) + { + selectIndex = 0; + timevalue = Math.Abs(int.Parse(timeifon["AdjustTime"])); + } + else + { + selectIndex = 1; + timevalue = 1; + } + PickerView.ShowSecondary(mList, mList2, (selectIndex1, selectIndex2) => + { - EventHandler<MouseEventArgs> timeclick = (sedner, e) => - { + switch (selectIndex1) + { + case 0: + case 2: + { + timevalue = int.Parse(listValues[selectIndex2].Split(' ')[0]); + if (selectIndex1 == 0) + { + timevalue = timevalue * -1; + } + } + break; + case 1: + timevalue = 0; + break; - DelayView(middle, textvalue, TypeValue); + } + + if (timeifon.ContainsKey("StartHour")) + { + timeifon.Remove("StartHour"); + } + if (timeifon.ContainsKey("StartMin")) + { + timeifon.Remove("StartMin"); + } + if (timeifon.ContainsKey("AdjustTime")) + { + timeifon.Remove("AdjustTime"); + } + timeifon.Add("AdjustTime", timevalue.ToString()); + UserView.HomePage.Instance.ScrollEnabled = false; + SelectedTimeTypeView(middle, TypeValue); + }, selectIndex, timevalue - 1, Language.StringByID(MyInternationalizationString.Advancedelay)); + }; - rowDelayType.MouseUpEventHandler += timeclick; - btnDelayTimeText.MouseUpEventHandler += timeclick; - btnDelayTime.MouseUpEventHandler += timeclick; - btnDelayTimeBack.MouseUpEventHandler += timeclick; #endregion } - - - var fra = new FrameLayout - { - Y = middle.Bottom, - Height = Application.GetRealHeight(200), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - this.AddChidren(fra); - var btnsave = 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(btnsave); - btnsave.MouseUpEventHandler += (sender, e) => + //淇濆瓨 + SaveView saveView = new SaveView(); + saveView.frameLayout.Y = middle.Bottom; + this.AddChidren(saveView.Show()); + saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { if (TypeValue == 0) { @@ -376,7 +308,7 @@ timeifon.Add("StartMin", timeview.Minute.ToString()); } - if (IsDeviceEditor) + if (IsEditor) { for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) { @@ -401,7 +333,7 @@ } } } - IsDeviceEditor = false; + IsEditor = false; } else { @@ -419,282 +351,99 @@ /// 澶勭悊閫変腑鏃堕棿绫诲瀷鐨勬柟娉� /// </summary> /// <param name="middle">Middle.</param> - void TimeTypeView(VerticalScrolViewLayout middle,int TypeValue) + void TimeTypeView(FrameLayout middle, int TypeValue) { UserView.HomePage.Instance.ScrollEnabled = false; - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor }; this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => + #region -------鍙栨秷 瀹屾垚 + CompleteView completeView = new CompleteView(); + flMain.AddChidren(completeView.Show(4)); + completeView.Btntitle.TextID = MyInternationalizationString.type; + EventHandler<MouseEventArgs> clickcancel = (sender, e) => { UserView.HomePage.Instance.ScrollEnabled = true; flMain.RemoveFromParent(); }; + flMain.MouseUpEventHandler += clickcancel; + completeView.Btncancel.MouseUpEventHandler += clickcancel; - var fraview = new FrameLayout { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(160*6), - Y = Application.GetRealHeight(1920 - 50 - 960), - X = Application.GetRealWidth(40), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(40), + #endregion + #region -------鏃ュ嚭锛屾棩钀斤紝姝e崍锛岃嚜瀹氫箟 + // 鏃ュ嚭 + mFunView sunriseView = new mFunView(); + sunriseView.frameLayout.Y = Application.GetRealHeight(140 + 20); + completeView.Show(4).AddChidren(sunriseView.Show()); + sunriseView.titleBtn.TextID = MyInternationalizationString.sunrise; + + //鏃ヨ惤 + mFunView sunsetView = new mFunView(); + sunsetView.frameLayout.Y = sunriseView.frameLayout.Bottom; + completeView.Show(4).AddChidren(sunsetView.Show()); + sunsetView.titleBtn.TextID = MyInternationalizationString.sunset; + + //姝e崍 + mFunView noonView = new mFunView(); + noonView.frameLayout.Y = sunsetView.frameLayout.Bottom; + completeView.Show(4).AddChidren(noonView.Show()); + noonView.titleBtn.TextID = MyInternationalizationString.noon; + + //鑷畾涔� + mFunView customView = new mFunView(); + customView.frameLayout.Y = noonView.frameLayout.Bottom; + completeView.Show(4).AddChidren(customView.Show()); + customView.titleBtn.TextID = MyInternationalizationString.logiccustom; + customView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; + + int value = -1; + sunriseView.clickviewBtn.MouseUpEventHandler += (sender, e) => { + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = true; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = false; + value = 1; }; - flMain.AddChidren(fraview); - - var textBtn = new Button { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(120), - TextAlignment=TextAlignment.Center, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextID=MyInternationalizationString.selectcommontimetype, - }; - fraview.AddChidren(textBtn); - - var timetypeframelayout = new VerticalScrolViewLayout + sunsetView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = true; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = false; + value = 2; + }; + noonView.clickviewBtn.MouseUpEventHandler += (sender, e) => { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(160*4), - Y = textBtn.Bottom, + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = true; + customView.selectedIconBtn.Visible = false; + value = 3; }; - fraview.AddChidren(timetypeframelayout); - - - var cancelBtn = new Button + customView.clickviewBtn.MouseUpEventHandler +=(sender, e) => { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(160), - TextAlignment = TextAlignment.Center, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextID = MyInternationalizationString.cancel, - Y = timetypeframelayout.Bottom+Application.GetRealHeight(40), - BackgroundColor= ZigbeeColor.Current.LogicTopViewBackgroundColor, - }; - fraview.AddChidren(cancelBtn); - cancelBtn.MouseUpEventHandler += (sender,e) => { + sunriseView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + sunsetView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + noonView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; + customView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; + sunriseView.selectedIconBtn.Visible = false; + sunsetView.selectedIconBtn.Visible = false; + noonView.selectedIconBtn.Visible = false; + customView.selectedIconBtn.Visible = true; UserView.HomePage.Instance.ScrollEnabled = true; flMain.RemoveFromParent(); - }; - List<string> timetypelist = new List<string> { - - Language.StringByID(MyInternationalizationString.sunrise), - Language.StringByID(MyInternationalizationString.sunset), - Language.StringByID(MyInternationalizationString.noon), - Language.StringByID(MyInternationalizationString.logiccustom), - - }; - - foreach (var typename in timetypelist) - { - - var timerowlayout = new RowLayout - { - Height = Application.GetRealHeight(160), - }; - timetypeframelayout.AddChidren(timerowlayout); - - var btntimetext = new Button - { - Text = typename, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextAlignment=TextAlignment.CenterLeft, - X=Application.GetRealWidth(40), - }; - timerowlayout.AddChidren(btntimetext); - - - EventHandler<MouseEventArgs> timesclick = (sender, e) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - int a = 0; - if(btntimetext.Text==Language.StringByID(MyInternationalizationString.logiccustom)){ - a = 0; - } - else if(btntimetext.Text == Language.StringByID(MyInternationalizationString.sunrise)){ - a = 1; - } - else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.sunset)) { - a = 2; - } - else if (btntimetext.Text == Language.StringByID(MyInternationalizationString.noon)) { - a = 3; - - } - if (a == TypeValue) - { - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - return; - } - - if (timeifon.ContainsKey("StartHour")) - { - timeifon.Remove("StartHour"); - } - if (timeifon.ContainsKey("StartMin")) - { - timeifon.Remove("StartMin"); - } - if (timeifon.ContainsKey("AdjustTime")) - { - timeifon.Remove("AdjustTime"); - } - if (timeifon.ContainsKey("DateType")) - { - timeifon.Remove("DateType"); - } - timeifon.Add("DateType", a.ToString()); - if (a == 0) - { - timeifon.Add("StartHour", "12"); - timeifon.Add("StartMin", "0"); - } - else - { - timeifon.Add("AdjustTime", "0"); - } - - SelectedTimeTypeView(middle, a); - - }; - timerowlayout.MouseUpEventHandler += timesclick; - btntimetext.MouseUpEventHandler += timesclick; - - } - } - /// <summary> - /// 閫変腑寤舵椂鏃堕棿鐨勫鐞嗘柟娉� - /// </summary> - /// <param name="middle">Middle.</param> - void DelayView(VerticalScrolViewLayout middle,string timename,int TypeValue) - { - UserView.HomePage.Instance.ScrollEnabled = false; - var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; - this.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender12, e12) => - { - UserView.HomePage.Instance.ScrollEnabled = true; - flMain.RemoveFromParent(); - }; - - var fraDelay = new FrameLayout - { - Width = Application.GetRealWidth(1080 - 80), - X = Application.GetRealWidth(40), - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - Radius = (uint)Application.GetRealHeight(50), - Height=Application.GetRealHeight(1260-250), - Y=Application.GetRealHeight(1920-1260+250), - }; - flMain.AddChidren(fraDelay); - - var titleTextfra = new FrameLayout - { - Height = Application.GetRealHeight(180), - }; - fraDelay.AddChidren(titleTextfra); - - - var btnTxet = new Button - { - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - Height = Application.GetRealHeight(180), - Width = Application.GetRealWidth(400), - //Text = "璇烽�夋嫨鏃堕棿", - TextID=MyInternationalizationString.selectedtime, - X = Application.GetRealWidth(300), - }; - titleTextfra.AddChidren(btnTxet); - - - var btnSave = new Button - { - Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(180), - Text = Language.StringByID(MyInternationalizationString.complete), - TextColor = ZigbeeColor.Current.LogicTextBlueColor, - X = Application.GetRealWidth(1000 - 200), - }; - titleTextfra.AddChidren(btnSave); - - - var timetypeframelayout = new VerticalScrolViewLayout - { - Width = Application.GetRealWidth(1080 - 80), - Height = Application.GetRealHeight(900-250+20), - Y =titleTextfra.Bottom, - BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, - }; - fraDelay.AddChidren(timetypeframelayout); - - var cancel = new Button - { - Height = Application.GetRealHeight(160), - TextID = MyInternationalizationString.cancel, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - TextSize = 16, - BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - Y =fraDelay.Height- Application.GetRealHeight(160), - - }; - fraDelay.AddChidren(cancel); - cancel.MouseUpEventHandler += (sender, e) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; - }; - - List<string> timevaluelist = new List<string> { - Language.StringByID(MyInternationalizationString.advance)+"10"+ Language.StringByID(MyInternationalizationString.logicminute), - Language.StringByID(MyInternationalizationString.advance)+"5"+ Language.StringByID(MyInternationalizationString.logicminute), - Language.StringByID(MyInternationalizationString.advance)+"1"+ Language.StringByID(MyInternationalizationString.logicminute), - Language.StringByID(MyInternationalizationString.nothing), - Language.StringByID(MyInternationalizationString.delayed)+"1"+ Language.StringByID(MyInternationalizationString.logicminute), - Language.StringByID(MyInternationalizationString.delayed)+"5"+ Language.StringByID(MyInternationalizationString.logicminute), - Language.StringByID(MyInternationalizationString.delayed)+"10"+ Language.StringByID(MyInternationalizationString.logicminute), - }; - string strvalue = ""; - foreach (var typename in timevaluelist) - { - var timerowlayout = new RowLayout - { - Height = Application.GetRealHeight(130), - LineColor=ZigbeeColor.Current.LogicBackgroundColor, - }; - timetypeframelayout.AddChidren(timerowlayout); - - var btntimetext = new Button - { - Text = typename, - Gravity = Gravity.Center, - TextColor = ZigbeeColor.Current.LogicTextBlackColor, - SelectedBackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor, - }; - timerowlayout.AddChidren(btntimetext); - if (timename == typename) - { - beforeClickButton.IsSelected = false; - beforeClickButton = btntimetext; - btntimetext.IsSelected = true; - strvalue = btntimetext.Text; - } - - EventHandler<MouseEventArgs> timesclick = (sender, e) => - { - strvalue = btntimetext.Text; - beforeClickButton.IsSelected = false; - beforeClickButton = btntimetext; - btntimetext.IsSelected = true; - }; - timerowlayout.MouseUpEventHandler += timesclick; - btntimetext.MouseUpEventHandler += timesclick; - - } - - btnSave.MouseUpEventHandler += (sender2, e2) => - { - flMain.RemoveFromParent(); - UserView.HomePage.Instance.ScrollEnabled = true; if (timeifon.ContainsKey("StartHour")) { timeifon.Remove("StartHour"); @@ -707,47 +456,46 @@ { timeifon.Remove("AdjustTime"); } - switch (strvalue) + if (timeifon.ContainsKey("DateType")) { - case "鎻愬墠10鍒嗛挓": - { - timeifon.Add("AdjustTime", "-10"); - } - break; - case "鎻愬墠5鍒嗛挓": - { - timeifon.Add("AdjustTime", "-5"); - } - break; - case "鎻愬墠1鍒嗛挓": - { - timeifon.Add("AdjustTime", "-1"); - } - break; - case "鏃�": - { - timeifon.Add("AdjustTime", "0"); - } - break; - case "寤舵椂1鍒嗛挓": - { - timeifon.Add("AdjustTime", "1"); - } - break; - case "寤舵椂5鍒嗛挓": - { - timeifon.Add("AdjustTime", "5"); - } - break; - case "寤舵椂10鍒嗛挓": - { - timeifon.Add("AdjustTime", "10"); - } - break; - + timeifon.Remove("DateType"); } - SelectedTimeTypeView(middle, TypeValue); + timeifon.Add("DateType", "0"); + timeifon.Add("StartHour", "12"); + timeifon.Add("StartMin", "0"); + SelectedTimeTypeView(middle, 0); }; + #endregion + completeView.Btncomplete.MouseUpEventHandler += (sender, e) => + { + if (value == -1) + { + return; + } + UserView.HomePage.Instance.ScrollEnabled = true; + flMain.RemoveFromParent(); + if (timeifon.ContainsKey("StartHour")) + { + timeifon.Remove("StartHour"); + } + if (timeifon.ContainsKey("StartMin")) + { + timeifon.Remove("StartMin"); + } + if (timeifon.ContainsKey("AdjustTime")) + { + timeifon.Remove("AdjustTime"); + } + if (timeifon.ContainsKey("DateType")) + { + timeifon.Remove("DateType"); + } + timeifon.Add("DateType", value.ToString()); + timeifon.Add("AdjustTime", "0"); + SelectedTimeTypeView(middle, value); + }; + } + } } -- Gitblit v1.8.0