| | |
| | | { |
| | | public class Cycle : FrameLayout |
| | | { |
| | | |
| | | Action action; |
| | | public Cycle(Action action) |
| | | { |
| | | this.action = action; |
| | | } |
| | | public Cycle() |
| | | { |
| | | Tag = "Logic"; |
| | | } |
| | | /// <summary> |
| | | /// 选中 |
| | | /// </summary> |
| | | Button beforeClickButton = new Button(); |
| | | |
| | | |
| | | public void Show() |
| | | { |
| | | Tag = "Logic"; |
| | | |
| | | this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor; |
| | | var topFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(140), |
| | | Y = Application.GetRealHeight(80), |
| | | }; |
| | | AddChidren(topFrameLayout); |
| | | #region 上面的布局代码 |
| | | TopView view = new TopView(); |
| | | this.AddChidren(view.TopRowView()); |
| | | view.toptitleNameBtn.TextID = MyInternationalizationString.cycle; |
| | | view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; |
| | | #endregion |
| | | |
| | | var titleName = new Button |
| | | { |
| | | TextID = MyInternationalizationString.cycle, |
| | | TextSize = 17, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | topFrameLayout.AddChidren(titleName); |
| | | |
| | | var hdl = new Button |
| | | var middle = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(154), |
| | | Height = Application.GetRealHeight(90), |
| | | X = Application.GetRealWidth(1080 - 170), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Logo/Logo.png", |
| | | Y = view.topRowLayout.Bottom, |
| | | Height = Application.GetRealHeight(Method.H - 184), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | }; |
| | | //topFrameLayout.AddChidren(hdl); |
| | | |
| | | 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(); |
| | | if (action != null) |
| | | action(); |
| | | }; |
| | | var titlerl = new RowLayout |
| | | { |
| | | Height = Application.GetRealHeight(180), |
| | | // BackgroundColor = 0xff0f0f0f, |
| | | 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 - 174); |
| | | middle.BackgroundColor =ZigbeeColor.Current.LogicBackgroundColor; |
| | | this.AddChidren(middle); |
| | | |
| | | |
| | | LogicView.SaveView saveView = new LogicView.SaveView(); |
| | | saveView.frameLayout.Y = middle.Height - Application.GetRealHeight(260); |
| | | middle.AddChidren(saveView.Show()); |
| | | |
| | | #region ----执行一次---- |
| | | |
| | | var cyclelist = new List<string>(); |
| | | cyclelist.AddRange(new string[] { |
| | | Language.StringByID(MyInternationalizationString.executeonce), |
| | | Language.StringByID(MyInternationalizationString.everyday), |
| | | //"今年", |
| | | //Language.StringByID(MyInternationalizationString.workingday), |
| | | //Language.StringByID(MyInternationalizationString.weekend), |
| | | Language.StringByID(MyInternationalizationString.monthly), |
| | | Language.StringByID(MyInternationalizationString.everyyear), |
| | | Language.StringByID(MyInternationalizationString.logicminute), |
| | | }); |
| | | FunView onceView = new FunView(); |
| | | onceView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | onceView.funnameBtn.TextID = MyInternationalizationString.executeonce; |
| | | onceView.funnextBtn.Width = Application.GetMinRealAverage(60); |
| | | onceView.funnextBtn.Height = Application.GetMinRealAverage(60); |
| | | onceView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; |
| | | onceView.funnextBtn.Visible = false; |
| | | middle.AddChidren(onceView.FunFrameView()); |
| | | |
| | | foreach (var name in cyclelist) |
| | | #endregion |
| | | |
| | | #region ----每天---- |
| | | FunView dayView = new FunView(); |
| | | dayView.funFrameLayout.Y = onceView.funFrameLayout.Bottom; |
| | | dayView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | dayView.funnameBtn.TextID = MyInternationalizationString.everyday; |
| | | dayView.funnextBtn.Width = Application.GetMinRealAverage(60); |
| | | dayView.funnextBtn.Height = Application.GetMinRealAverage(60); |
| | | dayView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png"; |
| | | dayView.funnextBtn.Visible = false; |
| | | middle.AddChidren(dayView.FunFrameView()); |
| | | |
| | | #endregion |
| | | |
| | | #region ----每周---- |
| | | |
| | | FunView weekView = new FunView(); |
| | | weekView.funFrameLayout.Y = dayView.funFrameLayout.Bottom; |
| | | weekView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | weekView.funnameBtn.TextID = MyInternationalizationString.weekly; |
| | | middle.AddChidren(weekView.FunFrameView()); |
| | | |
| | | #endregion |
| | | |
| | | #region ----每月---- |
| | | FunView monView = new FunView(); |
| | | monView.funFrameLayout.Y = weekView.funFrameLayout.Bottom; |
| | | monView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度; |
| | | monView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色 |
| | | monView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | monView.funnameBtn.TextID = MyInternationalizationString.monthly; |
| | | middle.AddChidren(monView.FunFrameView()); |
| | | |
| | | #endregion |
| | | |
| | | #region ----每年---- |
| | | FunView yearView = new FunView(); |
| | | yearView.funFrameLayout.Y = monView.funFrameLayout.Bottom; |
| | | yearView.iconBtn.UnSelectedImagePath = "ZigeeLogic/point.png"; |
| | | yearView.funnameBtn.TextID = MyInternationalizationString.everyyear; |
| | | //middle.AddChidren(yearView.FunFrameView()); |
| | | |
| | | yearView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var cyclerwLayout = new RowLayout |
| | | { |
| | | Height = Application.GetRealHeight(180), |
| | | }; |
| | | middle.AddChidren(cyclerwLayout); |
| | | var everyyearPage = new EveryyearPage(); |
| | | UserView.HomePage.Instance.AddChidren(everyyearPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | everyyearPage.Show(); |
| | | }; |
| | | |
| | | |
| | | var btn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(180), |
| | | Width = LayoutParams.MatchParent, |
| | | SelectedBackgroundColor = 0xfffe5e00, |
| | | }; |
| | | cyclerwLayout.AddChidren(btn); |
| | | #endregion |
| | | onceView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | onceView.funnextBtn.Visible = true; |
| | | dayView.funnextBtn.Visible = false; |
| | | }; |
| | | dayView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | onceView.funnextBtn.Visible = false; |
| | | dayView.funnextBtn.Visible = true; |
| | | |
| | | var btnName = new Button |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Text = name, |
| | | Width = Application.GetRealWidth(400), |
| | | Height = Application.GetRealHeight(100), |
| | | X = Application.GetRealWidth(30), |
| | | TextSize = 16, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | cyclerwLayout.AddChidren(btnName); |
| | | }; |
| | | weekView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | onceView.funnextBtn.Visible = false; |
| | | dayView.funnextBtn.Visible = false; |
| | | var weekPage = new WeekPage(); |
| | | UserView.HomePage.Instance.AddChidren(weekPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | weekPage.Show(weekView.funnameBtn.Text); |
| | | |
| | | var btntimeback = new Button |
| | | }; |
| | | monView.clickviewBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | onceView.funnextBtn.Visible = false; |
| | | dayView.funnextBtn.Visible = false; |
| | | var everymonthPage = new EverymonthPage(); |
| | | UserView.HomePage.Instance.AddChidren(everymonthPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | everymonthPage.Show(monView.funnameBtn.Text); |
| | | |
| | | }; |
| | | if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 0) |
| | | { |
| | | onceView.funnextBtn.Visible = true; |
| | | dayView.funnextBtn.Visible = false; |
| | | } |
| | | else if (Common.Logic.CurrentLogic.TimeAttribute.Repeat == 2) |
| | | { |
| | | onceView.funnextBtn.Visible = false; |
| | | dayView.funnextBtn.Visible = true; |
| | | } |
| | | else |
| | | { |
| | | onceView.funnextBtn.Visible = false; |
| | | dayView.funnextBtn.Visible = false; |
| | | } |
| | | saveView.clickviewBtn.MouseUpEventHandler += (sedder, e) => |
| | | { |
| | | if (!onceView.funnextBtn.Visible && !dayView.funnextBtn.Visible) |
| | | { |
| | | Width = Application.GetRealWidth(110), |
| | | Height = Application.GetRealHeight(110), |
| | | //UnSelectedImagePath = "MusicIcon/Next.png", |
| | | SelectedImagePath = "ZigeeLogic/next.png", |
| | | X = Application.GetRealWidth(1080 - 140), |
| | | }; |
| | | if (name == Language.StringByID(MyInternationalizationString.monthly) || name == Language.StringByID(MyInternationalizationString.everyyear) || name == Language.StringByID(MyInternationalizationString.logiccustom)) |
| | | { |
| | | cyclerwLayout.AddChidren(btntimeback); |
| | | |
| | | |
| | | var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, |
| | | Language.StringByID(MyInternationalizationString.selectweek), |
| | | Language.StringByID(MyInternationalizationString.confrim)); |
| | | alert.Show(); |
| | | return; |
| | | } |
| | | |
| | | //if (timename == name) { |
| | | // beforeClickButton.IsSelected = false; |
| | | // beforeClickButton = btn; |
| | | // btn.IsSelected = true; |
| | | //} |
| | | |
| | | EventHandler<MouseEventArgs> timeclick = (sender, e) => |
| | | if (onceView.funnextBtn.Visible) |
| | | { |
| | | if (btnName.Text == Language.StringByID(MyInternationalizationString.logiccustom)) |
| | | { |
| | | var weekPage = new WeekPage(); |
| | | UserView.HomePage.Instance.AddChidren(weekPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | weekPage.Show(); |
| | | } |
| | | else if (btnName.Text == Language.StringByID(MyInternationalizationString.monthly)) |
| | | { |
| | | var everymonthPage = new EverymonthPage(); |
| | | UserView.HomePage.Instance.AddChidren(everymonthPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | everymonthPage.Show(); |
| | | } |
| | | else if (btnName.Text == Language.StringByID(MyInternationalizationString.everyyear)) |
| | | { |
| | | var everyyearPage = new EveryyearPage(); |
| | | UserView.HomePage.Instance.AddChidren(everyyearPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | everyyearPage.Show(); |
| | | } |
| | | else |
| | | { |
| | | beforeClickButton.IsSelected = false; |
| | | beforeClickButton = btn; |
| | | btn.IsSelected = true; |
| | | if (btnName.Text == Language.StringByID(MyInternationalizationString.everyday)) |
| | | { |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 2; |
| | | } |
| | | else if (btnName.Text == Language.StringByID(MyInternationalizationString.executeonce)) |
| | | { |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 0; |
| | | } |
| | | } |
| | | }; |
| | | cyclerwLayout.MouseUpEventHandler += timeclick; |
| | | btn.MouseUpEventHandler += timeclick; |
| | | btnName.MouseUpEventHandler += timeclick; |
| | | btntimeback.MouseUpEventHandler += timeclick; |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 0; |
| | | |
| | | }; |
| | | |
| | | var btncomplete = new Button |
| | | { |
| | | Y = middle.Bottom, |
| | | Height = Application.GetRealHeight(174), |
| | | TextID = MyInternationalizationString.complete, |
| | | //BackgroundColor = 0xff1f1f1f, |
| | | TextSize = 16, |
| | | TextColor = ZigbeeColor.Current.LogicTextBlackColor, |
| | | }; |
| | | AddChidren(btncomplete); |
| | | |
| | | btncomplete.MouseUpEventHandler += (sedder, e) => |
| | | { |
| | | } |
| | | if (dayView.funnextBtn.Visible) |
| | | { |
| | | Common.Logic.CurrentLogic.TimeAttribute.Repeat = 2; |
| | | } |
| | | RemoveFromParent(); |
| | | action(); |
| | | |
| | | }; |
| | | |
| | | } |