New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | using Shared.Common; |
| | | using Shared.R; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.Device.Logic |
| | | { |
| | | public class IgnoreTime : FrameLayout |
| | | { |
| | | |
| | | public IgnoreTime() |
| | | { |
| | | Tag = "Logic"; |
| | | |
| | | } |
| | | Button selectedIcon = new Button(); |
| | | public void Show(CommonDevice common, string name, bool edit, int timevalue,string _if) |
| | | { |
| | | |
| | | #region 上面的布局代码 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.Text= name; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | #endregion |
| | | |
| | | var middle = new VerticalScrolViewLayout |
| | | { |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(Method.H - 184 - 260), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | this.AddChidren(middle); |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.Y = middle.Bottom; |
| | | this.AddChidren(saveView.Show()); |
| | | |
| | | int selectetimedvalue = 0; |
| | | var timestrlist = new List<string> { "2", "5", "10", "20", "30", Language.StringByID(MyInternationalizationString.logiccustom) }; |
| | | foreach (var intValue in timestrlist) |
| | | { |
| | | |
| | | FunView monView = new FunView(); |
| | | monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | monView.funnameBtn.Text = intValue + Language.StringByID(MyInternationalizationString.Minute); |
| | | monView.funnameBtn.Tag = intValue; |
| | | monView.funnextBtn.Width = Application.GetMinRealAverage(60); |
| | | monView.funnextBtn.Height = Application.GetMinRealAverage(60); |
| | | monView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; |
| | | monView.funnextBtn.Visible = false; |
| | | middle.AddChidren(monView.FunFrameView()); |
| | | |
| | | |
| | | //判断一个字符是字符串还是数字 |
| | | if (intValue.Length < 3) |
| | | { |
| | | if (timevalue == int.Parse(intValue) * 60) |
| | | { |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = monView.funnextBtn; |
| | | monView.funnextBtn.Visible = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度; |
| | | monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色 |
| | | } |
| | | monView.clickviewBtn.MouseUpEventHandler+= (sender, e) => |
| | | { |
| | | selectedIcon.Visible = false; |
| | | selectedIcon = monView.funnextBtn; |
| | | monView.funnextBtn.Visible = true; |
| | | if (Language.StringByID(MyInternationalizationString.logiccustom) == monView.funnameBtn.Tag.ToString()) |
| | | { |
| | | var secondList = new List<string>(); |
| | | var minuteList = new List<string>(); |
| | | for (int i = 0; i < 60; i++) |
| | | { |
| | | if (i < 10) |
| | | { |
| | | var a = "0" + i.ToString(); |
| | | secondList.Add(a + " " + Language.StringByID(MyInternationalizationString.second)); |
| | | minuteList.Add(a + " " + Language.StringByID(MyInternationalizationString.minute)); |
| | | } |
| | | else |
| | | { |
| | | secondList.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second)); |
| | | minuteList.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute)); |
| | | } |
| | | |
| | | } |
| | | int selectIndex1 = 0; |
| | | int selectIndex2 = 0; |
| | | if (timevalue > 3600) |
| | | { |
| | | selectIndex1 = 60; |
| | | selectIndex2 = timevalue - 3600; |
| | | } |
| | | else |
| | | { |
| | | selectIndex1 = timevalue / 60; |
| | | selectIndex2 = timevalue % 60; |
| | | } |
| | | PickerView.ShowNormal(minuteList, secondList, null, (Index1, Index2, Index3) => |
| | | { |
| | | selectetimedvalue = int.Parse(minuteList[Index1].Split(' ')[0]) * 60 + int.Parse(secondList[Index2].Split(' ')[0]); |
| | | TimeMethod(common, selectetimedvalue, timevalue, edit, _if); |
| | | }, selectIndex1, selectIndex2, 0, Language.StringByID(MyInternationalizationString.logiccustom)); |
| | | } |
| | | else |
| | | { |
| | | selectetimedvalue = int.Parse(monView.funnameBtn.Tag.ToString()) * 60; |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | TimeMethod(common, selectetimedvalue, timevalue, edit,_if); |
| | | }; |
| | | } |
| | | |
| | | public void TimeMethod(CommonDevice common, int selectetimedvalue, int timevalue, bool edit,string _if) |
| | | { |
| | | |
| | | var deviceConditionsInfo = new Dictionary<string, string>(); |
| | | deviceConditionsInfo.Add("Type", "1"); |
| | | deviceConditionsInfo.Add("IsValid", "1"); |
| | | deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); |
| | | deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); |
| | | deviceConditionsInfo.Add("Cluster_ID", "1280"); |
| | | deviceConditionsInfo.Add("AttriButeId", "1281"); |
| | | deviceConditionsInfo.Add("AttriButeData1", "1"); |
| | | deviceConditionsInfo.Add("AttriButeData2", "0"); |
| | | deviceConditionsInfo.Add("Range", "5"); |
| | | if (selectetimedvalue != 0) |
| | | { |
| | | if (timevalue != selectetimedvalue) |
| | | { |
| | | if (deviceConditionsInfo.ContainsKey("IgnoreTime")) |
| | | { |
| | | deviceConditionsInfo.Remove("IgnoreTime"); |
| | | } |
| | | deviceConditionsInfo.Add("IgnoreTime", selectetimedvalue.ToString()); |
| | | LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (!edit) |
| | | { |
| | | |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.delaytip), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | switch (_if) |
| | | { |
| | | case "logic": |
| | | { |
| | | //自动化 |
| | | var logicCommunalPage = new LogicCommunalPage(); |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | } |
| | | break; |
| | | case "mould": |
| | | { |
| | | //自动化推荐模板 |
| | | var templatePage = new TemplatePage(); |
| | | UserView.HomePage.Instance.AddChidren(templatePage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | templatePage.Show(); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | |
| | | //var logicCommunalPage = new LogicCommunalPage(); |
| | | //UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | //UserView.HomePage.Instance.PageIndex += 1; |
| | | //logicCommunalPage.Show(() => { }); |
| | | |
| | | } |
| | | } |
| | | } |