| | |
| | | Tag = "Logic"; |
| | | } |
| | | |
| | | public void Show () |
| | | public void Show (string titlename) |
| | | { |
| | | var weeklist = new List<string> (); |
| | | |
| | | this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; |
| | | var topFrameLayout = new FrameLayout |
| | | #region 界面的布局代码 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.Text=titlename; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | var middle = new VerticalScrolViewLayout |
| | | { |
| | | Height = Application.GetRealHeight(140), |
| | | Y = Application.GetRealHeight(80), |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(Method.H - 184-260), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | AddChidren(topFrameLayout); |
| | | this.AddChidren(middle); |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.Y = middle.Bottom; |
| | | this.AddChidren(saveView.Show()); |
| | | #endregion |
| | | |
| | | var titleName = new Button |
| | | { |
| | | TextID = MyInternationalizationString.cycle, |
| | | TextSize = 17, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | topFrameLayout.AddChidren (titleName); |
| | | |
| | | 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) => |
| | | { |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | var titlerl = new RowLayout { |
| | | Height = Application.GetRealHeight (180), |
| | | Y = Application.GetRealHeight (220), |
| | | }; |
| | | AddChidren (titlerl); |
| | | |
| | | 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; |
| | | this.AddChidren (middle); |
| | | |
| | | var weeklist = new List<string>(); |
| | | if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 5) |
| | | { |
| | | string len = ""; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | var cyclelist = new List<string> (); |
| | | cyclelist.AddRange (new string [] { |
| | | Language.StringByID(MyInternationalizationString.mon), |
| | |
| | | Language.StringByID(MyInternationalizationString.sat), |
| | | Language.StringByID(MyInternationalizationString.sun), |
| | | }); |
| | | foreach (var name in cyclelist) { |
| | | var cyclerwLayout = new RowLayout { |
| | | Height = Application.GetRealHeight (180), |
| | | }; |
| | | middle.AddChidren (cyclerwLayout); |
| | | foreach (var name in cyclelist) |
| | | { |
| | | |
| | | var btnname = new Button { |
| | | X = Application.GetRealWidth (40), |
| | | Width = Application.GetRealWidth (600), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = name, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | cyclerwLayout.AddChidren (btnname); |
| | | |
| | | var btnCheck = new Button { |
| | | Width = Application.GetRealWidth (115), |
| | | Height = Application.GetRealHeight (110), |
| | | Gravity = Gravity.CenterVertical, |
| | | X = Application.GetRealWidth (1080-140), |
| | | SelectedImagePath = "ZigeeLogic/CheckOn.png", |
| | | UnSelectedImagePath = "ZigeeLogic/Check.png", |
| | | }; |
| | | cyclerwLayout.AddChidren (btnCheck); |
| | | |
| | | var str = weeklist.Find ((o) => { return o == name; }); |
| | | if (str != null) { |
| | | btnCheck.IsSelected = true; |
| | | } |
| | | ///选中时间 |
| | | EventHandler<MouseEventArgs> weekclick = (sender, e) => |
| | | FunView monView = new FunView(); |
| | | monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | monView.funnameBtn.Text= name; |
| | | 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 (Language.StringByID(MyInternationalizationString.sun) == name) |
| | | { |
| | | btnCheck.IsSelected = !btnCheck.IsSelected; |
| | | if (btnCheck.IsSelected) |
| | | monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度; |
| | | monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色 |
| | | } |
| | | |
| | | var str = weeklist.Find((o) => { return o == name; }); |
| | | if (str != null) |
| | | { |
| | | monView.funnextBtn.Visible = true; |
| | | } |
| | | monView.clickviewBtn.MouseUpEventHandler+= (sender, e) => |
| | | { |
| | | monView.funnextBtn.Visible = !monView.funnextBtn.Visible; |
| | | if (monView.funnextBtn.Visible) |
| | | { |
| | | var d = weeklist.Find((o) => { return o == name; }); |
| | | if (d == null) |
| | |
| | | } |
| | | else |
| | | { |
| | | weeklist.RemoveAll((o) => { |
| | | weeklist.RemoveAll((o) => |
| | | { |
| | | return o == name; |
| | | }); |
| | | } |
| | | int weekvalue = 0; |
| | | foreach (var strname in weeklist) |
| | | { |
| | | if (Language.StringByID(MyInternationalizationString.mon) == strname) |
| | | { |
| | | weekvalue += 1; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.tue) == strname) |
| | | { |
| | | weekvalue += 2; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.wed) == strname) |
| | | { |
| | | weekvalue += 4; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.thu) == strname) |
| | | { |
| | | weekvalue += 8; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.frl) == strname) |
| | | { |
| | | weekvalue += 16; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sat) == strname) |
| | | { |
| | | weekvalue += 32; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sun) == strname) |
| | | { |
| | | weekvalue += 64; |
| | | } |
| | | } |
| | | |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 5; |
| | | Common.Logic.CurrentLogic.TimeAttribute.WeekDay = weekvalue; |
| | | }; |
| | | cyclerwLayout.MouseUpEventHandler += weekclick; |
| | | btnname.MouseUpEventHandler += weekclick; |
| | | btnCheck.MouseUpEventHandler += weekclick; |
| | | |
| | | |
| | | } |
| | | saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | int weekvalue = 0; |
| | | foreach (var strname in weeklist) |
| | | { |
| | | if (Language.StringByID(MyInternationalizationString.mon) == strname) |
| | | { |
| | | weekvalue += 1; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.tue) == strname) |
| | | { |
| | | weekvalue += 2; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.wed) == strname) |
| | | { |
| | | weekvalue += 4; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.thu) == strname) |
| | | { |
| | | weekvalue += 8; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.frl) == strname) |
| | | { |
| | | weekvalue += 16; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sat) == strname) |
| | | { |
| | | weekvalue += 32; |
| | | } |
| | | else if (Language.StringByID(MyInternationalizationString.sun) == strname) |
| | | { |
| | | weekvalue += 64; |
| | | } |
| | | } |
| | | if (weekvalue == 0) |
| | | { |
| | | var alert = new ShowMsgControl(ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.selectweek), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 5; |
| | | Common.Logic.CurrentLogic.TimeAttribute.WeekDay = weekvalue; |
| | | |
| | | |
| | | var logicCommunalPage = new LogicCommunalPage { }; |
| | | UserView.HomePage.Instance.AddChidren(logicCommunalPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | logicCommunalPage.Show(() => { }); |
| | | }; |
| | | |
| | | |
| | | |