From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 16 四月 2020 17:10:57 +0800 Subject: [PATCH] 请合并代码 --- ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs | 213 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 213 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs new file mode 100755 index 0000000..232bbd8 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DelayTime.cs @@ -0,0 +1,213 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared; +using Shared.Common; +using Shared.Phone; +using Shared.R; +using ZigBee.Device; + + + +namespace Shared.Phone.Device.Logic +{ + public class DelayTime : FrameLayout + { + public DelayTime() + { + Tag = "Logic"; + } + + public void Show(int isInt = 0, bool edit = false) + { + + + #region 涓婇潰鐨勫竷灞�浠g爜 + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.TextID = MyInternationalizationString.adddelay; + view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; + #endregion + + var middle = new FrameLayout + { + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(Method.H - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + + var blancolorFl = new FrameLayout + { + Width = Application.GetMinRealAverage(200), + Height = Application.GetMinRealAverage(200), + Y = Application.GetRealHeight(130), + BackgroundColor = 0xFFFFFFFF, + Radius = (uint)Application.GetMinRealAverage(100), + X = Application.GetRealWidth(440), + }; + middle.AddChidren(blancolorFl); + var colorBtn = new Button + { + Width = Application.GetMinRealAverage(200-24), + Height =Application.GetMinRealAverage(200-24), + X = Application.GetMinRealAverage(12), + Y = Application.GetMinRealAverage(12), + BackgroundColor = 0xFFFEF1ED, + Radius = (uint)Application.GetMinRealAverage(88), + }; + blancolorFl.AddChidren(colorBtn); + var btnicon = new Button + { + X = Application.GetMinRealAverage(58), + Y = Application.GetMinRealAverage(58), + Width = Application.GetMinRealAverage(84), + Height = Application.GetMinRealAverage(84), + UnSelectedImagePath = "ZigeeLogic/delay.png", + }; + blancolorFl.AddChidren(btnicon); + var titleText = new Button + { + Width = Application.GetRealWidth(580), + Height = Application.GetRealHeight(60), + X = Application.GetRealWidth(250), + Y = blancolorFl.Bottom + Application.GetRealHeight(50), + TextID = MyInternationalizationString.createtimetext, + TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 15, + + }; + middle.AddChidren(titleText); + + var PickerViewfra = new FrameLayout + { + Y = titleText.Bottom + Application.GetRealHeight(250), + Height = Application.GetRealHeight(1046), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + middle.AddChidren(PickerViewfra); + PickerViewfra.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + + var mUIPickerView = new UIPickerView + { + Y = Application.GetRealHeight(50), + Height = Application.GetRealHeight(600), + //Width=Application.GetRealWidth(1080-400), + //X=Application.GetRealWidth(200), + }; + PickerViewfra.AddChidren(mUIPickerView); + + var mList1 = new List<string>(); + var mList2 = new List<string>(); + for (int i = 0; i < 60; i++) + { + if (i < 10) + { + var a = "0" + i.ToString(); + mList1.Add(a + " " + Language.StringByID(MyInternationalizationString.minute)); + mList2.Add(a + " " + Language.StringByID(MyInternationalizationString.second)); + } + else + { + mList1.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute)); + mList2.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second)); + } + + } + + mUIPickerView.setNPicker(mList1, mList2,null); + ///榛樿鐘舵�� + mUIPickerView.setCurrentItems(0, 5, 0); + int timevalue = 5; + int value = 0; + if (edit) + { + + timevalue = int.Parse(Common.Logic.CurrentLogic.Actions[isInt]["DelayTime"].ToString()); + if (timevalue > 3600) + { + //鏇存柊鏈�鏂扮姸鎬� + mUIPickerView.setCurrentItems(60, timevalue - 3600, 0); + } + else + { + + var minutevalue1 = timevalue / 60; + var secondvalue1 = timevalue % 60; + //鏇存柊鏈�鏂扮姸鎬� + mUIPickerView.setCurrentItems(minutevalue1, secondvalue1, 0); + } + + value = timevalue; + } + string selectde = ""; + mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) => + { + var minutevalue = int.Parse(mList1[s1].Split(' ')[0]); + var secondvalue = int.Parse(mList2[s2].Split(' ')[0]); + timevalue = minutevalue * 60 + secondvalue; + selectde = "yes"; + + }; + + + + + var btnsave = new Button + { + Y = PickerViewfra.Height - Application.GetRealHeight(260), + X = Application.GetRealWidth(85), + Height = Application.GetRealHeight(130), + Width = Application.GetRealWidth(910), + Radius = (uint)Application.GetRealHeight(60), + BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, + TextID = MyInternationalizationString.Save, + TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, + TextSize=16, + }; + PickerViewfra.AddChidren(btnsave); + + ///瀹屾垚鐐瑰嚮浜嬩欢 + btnsave.MouseUpEventHandler += (sender, e) => + { + if (timevalue == 0) + { + return; + } + if (selectde != "" || timevalue == 5) + { + Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); + actionsInfo.Add("LinkType", 7); + actionsInfo.Add("DelayTime", timevalue); + if (edit) + { + Common.Logic.CurrentLogic.Actions.RemoveAt(isInt); + Common.Logic.CurrentLogic.Actions.Insert(isInt, actionsInfo); + } + else + { + Common.Logic.CurrentLogic.Actions.Add(actionsInfo); + + } + } + else + { + if (!edit) + { + var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt), + Language.StringByID(MyInternationalizationString.delaytip), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); + return; + } + } + var logicCommunalPage = new LogicCommunalPage { }; + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + }; + + } + } +} + + -- Gitblit v1.8.0