using System; using System.Collections.Generic; 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 { public class OneTimePoint : FrameLayout { public OneTimePoint() { Tag = "Logic"; } public void Show(Action action) { #region 上面的布局代码 TopView view = new TopView(); this.AddChidren(view.TopRowView()); view.toptitleNameBtn.TextID = MyInternationalizationString.addtime; view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); action(""); }; #endregion var middle = new FrameLayout { Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(Method.H - 184 - 260), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); #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; TypeView skView = new TypeView(); skView.frameLayout.Y = typeView.frameLayout.Bottom; middle.AddChidren(skView.Show()); skView.textBtn.TextID = MyInternationalizationString.moment; skView.backBtn.UnSelectedImagePath = "ZigeeLogic/dropdown.png"; #endregion var rowTimeView = new FrameLayout { Y = skView.frameLayout.Bottom, Height = Application.GetRealHeight(600), }; middle.AddChidren(rowTimeView); TimeView timeview = new TimeView { Height = Application.GetRealHeight(550), BackgroundColor = 0x40ffffff, Width = Application.GetRealWidth(1080), }; rowTimeView.AddChidren(timeview); //保存 SaveView saveView = new SaveView(); saveView.frameLayout.Y = middle.Bottom; this.AddChidren(saveView.Show()); saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => { string h = timeview.Hour.ToString(); string m = timeview.Minute.ToString(); Dictionary timeIfon = new Dictionary(); timeIfon.Add("Type", "0"); timeIfon.Add("IsValid", "1"); timeIfon.Add("DateType", "0"); timeIfon.Add("RemindTime", "0"); timeIfon.Add("EnDelay", "0"); timeIfon.Add("DelayTime", "0"); timeIfon.Add("DoorLockOpenDelayTime", "0"); timeIfon.Add("StartHour", h); timeIfon.Add("StartMin", m); for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) { if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "0") { Common.Logic.CurrentLogic.Conditions.RemoveAt(i); Common.Logic.CurrentLogic.Conditions.Insert(i, timeIfon); break; } } string s = h + ":" + (m.Length < 2 ? "0" + m : m); this.RemoveFromParent(); action(s); }; } } }