| | |
| | | |
| | | public void Show() |
| | | { |
| | | |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | this.AddChidren(topView.FLayoutView()); |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | LogicView.DateView dateView = new LogicView.DateView(); |
| | | dateView.FLayoutView(fLayout, 7); |
| | | dateView.btnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | for (int i = 0; i < 7; i++) { |
| | | LogicView.SelectTypeView dateTypeView = new LogicView.SelectTypeView(); |
| | | dateTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); |
| | | dateTypeView.btnIcon.Visible = false; |
| | | dateTypeView.btnText.X = Application.GetRealWidth(20); |
| | | dateTypeView.btnText.TextID = StringId.time; |
| | | dateTypeView.btnNextIcon.X = Application.GetRealWidth(307); |
| | | dateView.AddChidren(dateTypeView.FLayoutView()); |
| | | } |
| | | DateMethod(fLayout,cyclicTitle.btnText); |
| | | |
| | | |
| | | }; |
| | | #endregion |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 循环方式(每天,每月。。) |
| | | /// </summary> |
| | | /// <param name="fLayout">弹框主控件</param> |
| | | /// <param name="button">显示文本</param> |
| | | public void DateMethod(FrameLayout fLayout,Button button) |
| | | { |
| | | |
| | | LogicView.DateView dateView = new LogicView.DateView(); |
| | | dateView.btnTitle.TextID = StringId.cyclic; |
| | | dateView.FLayoutView(fLayout, 4); |
| | | dateView.btnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | //定义一个局部变量记录选中文本状态 |
| | | string weekName = ""; |
| | | //定义一个局部Btn用来记录选中Btn; |
| | | var selecetdBtn = new Button(); |
| | | for (int i = 0; i < 4; i++) |
| | | { |
| | | LogicView.SelectTypeView dateTypeView = new LogicView.SelectTypeView(); |
| | | dateTypeView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence; |
| | | dateTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); |
| | | dateTypeView.btnIcon.Visible = false; |
| | | dateTypeView.btnText.X = Application.GetRealWidth(20); |
| | | dateTypeView.btnNextIcon.X = Application.GetRealWidth(307); |
| | | dateTypeView.btnLine.X = Application.GetRealWidth(20); |
| | | dateTypeView.btnLine.Width = Application.GetRealWidth(303); |
| | | dateView.frameLayout.AddChidren(dateTypeView.FLayoutView()); |
| | | dateTypeView.btnClick.Tag = i;//标记类型 |
| | | switch (i) |
| | | { |
| | | case 0: |
| | | { |
| | | weekName = Language.StringByID(StringId.performA); |
| | | dateTypeView.btnNextIcon.Visible = false; |
| | | } |
| | | break; |
| | | case 1: |
| | | { |
| | | weekName = Language.StringByID(StringId.days); |
| | | dateTypeView.btnNextIcon.Visible = false; |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | weekName = Language.StringByID(StringId.weekly); |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | weekName = Language.StringByID(StringId.monthly); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | dateTypeView.btnText.Text = weekName; |
| | | //循环类型(例如:每月,每天)点击事件 |
| | | dateTypeView.btnClick.MouseUpEventHandler += (sender, e) => { |
| | | int clickIndex = int.Parse(dateTypeView.btnClick.Tag.ToString()); |
| | | switch (clickIndex) |
| | | { |
| | | case 0: |
| | | { |
| | | weekName = Language.StringByID(StringId.performA); |
| | | selecetdBtn.TextColor = CSS.CSS_Color.textColor; |
| | | dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | selecetdBtn = dateTypeView.btnText; |
| | | } |
| | | break; |
| | | case 1: |
| | | { |
| | | weekName = Language.StringByID(StringId.days); |
| | | selecetdBtn.TextColor = CSS.CSS_Color.textColor; |
| | | dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | selecetdBtn = dateTypeView.btnText; |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | // weekName = Language.StringByID(StringId.weekly); |
| | | WeekMethod(fLayout, button); |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | //weekName = Language.StringByID(StringId.monthly); |
| | | MonMethod(fLayout, button); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | }; |
| | | |
| | | |
| | | //显示之前的状态 |
| | | if (button.Text == weekName) |
| | | { |
| | | dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | selecetdBtn = dateTypeView.btnText; |
| | | } |
| | | else if (button.Text == weekName) |
| | | { |
| | | dateTypeView.btnText.TextColor = CSS.CSS_Color.textConfirmColor; |
| | | selecetdBtn = dateTypeView.btnText; |
| | | } |
| | | } |
| | | //确定保存 |
| | | dateView.btnConfirm.MouseUpEventHandler += (sender3, e3) => |
| | | { |
| | | if (weekName == Language.StringByID(StringId.performA)) |
| | | { |
| | | //执行一次 |
| | | Logic.currlogic.cycle.type = "once"; |
| | | } |
| | | else if (weekName == Language.StringByID(StringId.performA)) |
| | | { |
| | | //每天 |
| | | Logic.currlogic.cycle.type = "day"; |
| | | |
| | | } |
| | | //选中保存之后显示文本 |
| | | button.Text = weekName; |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 选中星期几(周一,周二 。。。) |
| | | /// </summary> |
| | | /// <param name="fLayout">弹框主控件</param> |
| | | /// <param name="button">显示文本</param> |
| | | public void WeekMethod(FrameLayout fLayout, Button button) |
| | | { |
| | | |
| | | LogicView.DateView weekView = new LogicView.DateView(); |
| | | weekView.btnTitle.TextID = StringId.cyclic; |
| | | weekView.FLayoutView(fLayout, 7); |
| | | weekView.btnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | weekView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | //定义一个局部weekList列表用来记录选中数据; |
| | | List<string> weekList = new List<string>(); |
| | | if (Logic.currlogic.cycle.type == "mon") |
| | | { |
| | | //加载之前保存的数据 |
| | | weekList.AddRange(Logic.currlogic.cycle.value); |
| | | } |
| | | //定义一个局部变量记录选中文本状态 |
| | | string weekName = ""; |
| | | for (int i = 0; i < 7; i++) |
| | | { |
| | | LogicView.SelectTypeView weekTypeView = new LogicView.SelectTypeView(); |
| | | weekTypeView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence; |
| | | weekTypeView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); |
| | | weekTypeView.btnIcon.Visible = false; |
| | | weekTypeView.btnText.X = Application.GetRealWidth(20); |
| | | weekTypeView.btnLine.X = Application.GetRealWidth(20); |
| | | weekTypeView.btnLine.Width = Application.GetRealWidth(303); |
| | | weekTypeView.btnNextIcon.X = Application.GetRealWidth(303); |
| | | weekTypeView.btnNextIcon.Width = Application.GetMinRealAverage(28); |
| | | weekTypeView.btnNextIcon.Height = Application.GetMinRealAverage(28); |
| | | weekTypeView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png"; |
| | | weekTypeView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png"; |
| | | weekView.frameLayout.AddChidren(weekTypeView.FLayoutView()); |
| | | weekTypeView.btnClick.Tag = i;//标记索引 |
| | | switch (i) |
| | | { |
| | | case 0: |
| | | { |
| | | weekName = Language.StringByID(StringId.monday); |
| | | } |
| | | break; |
| | | case 1: |
| | | { |
| | | weekName = Language.StringByID(StringId.tuesday); |
| | | } |
| | | break; |
| | | case 2: |
| | | { |
| | | weekName = Language.StringByID(StringId.wednesday); |
| | | } |
| | | break; |
| | | case 3: |
| | | { |
| | | weekName = Language.StringByID(StringId.thursday); |
| | | } |
| | | break; |
| | | case 4: |
| | | { |
| | | weekName = Language.StringByID(StringId.friday); |
| | | } |
| | | break; |
| | | case 5: |
| | | { |
| | | weekName = Language.StringByID(StringId.saturday); |
| | | } |
| | | break; |
| | | case 6: |
| | | { |
| | | weekName = Language.StringByID(StringId.sunday); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | weekTypeView.btnText.Text = weekName; |
| | | if (weekList.Contains(i.ToString())) |
| | | { |
| | | //显示之前的选中状态 |
| | | weekTypeView.btnNextIcon.IsSelected = true; |
| | | } |
| | | //星期的点击事件 |
| | | weekTypeView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | string clickIndex = weekTypeView.btnClick.Tag.ToString(); |
| | | weekTypeView.btnClick.IsSelected = !weekTypeView.btnClick.IsSelected; |
| | | if (weekTypeView.btnClick.IsSelected) |
| | | { |
| | | weekTypeView.btnNextIcon.IsSelected = true; |
| | | if (!weekList.Contains(clickIndex)) |
| | | { |
| | | //添加选中数据 |
| | | weekList.Add(clickIndex); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | weekTypeView.btnNextIcon.IsSelected = false; |
| | | if (weekList.Contains(clickIndex)) |
| | | { |
| | | //移除选中数据 |
| | | weekList.Remove(clickIndex); |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | } |
| | | //确定点击事件 |
| | | weekView.btnConfirm.MouseUpEventHandler += (sender1, e1) => { |
| | | if (weekList.Count==0) { |
| | | //提示:还没选中执行周期 |
| | | return; |
| | | } |
| | | Logic.currlogic.cycle.type = "mon"; |
| | | Logic.currlogic.cycle.value = weekList; |
| | | button.Text = GetWeekString(weekList); |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 每月 |
| | | /// </summary> |
| | | /// <param name="fLayout">弹框主控件</param> |
| | | /// <param name="button">显示文本</param> |
| | | public void MonMethod(FrameLayout fLayout, Button button) |
| | | { |
| | | LogicView.MonView monView = new LogicView.MonView(); |
| | | monView.btnTitle.TextID = StringId.monthly; |
| | | monView.FLayoutView(fLayout); |
| | | monView.btnCancel.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | monView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | //58 |
| | | int lineSun = 0; |
| | | for (int i = 0; i < 32; i++) |
| | | { |
| | | Button monTextBtn = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(30), |
| | | Height = Application.GetMinRealAverage(30), |
| | | }; |
| | | if (i % 7 == 0) |
| | | { |
| | | } |
| | | else { } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取星期的字符串 |
| | | /// </summary> |
| | | /// <param name="weekList"></param> |
| | | /// <returns></returns> |
| | | public string GetWeekString(List<string> weekList) |
| | | { |
| | | string weekTextName = ""; |
| | | |
| | | if (weekList.Contains("0")) { |
| | | weekTextName += Language.StringByID(StringId.monday)+","; |
| | | } |
| | | if (weekList.Contains("1")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.tuesday) + ","; |
| | | } |
| | | if (weekList.Contains("2")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.wednesday) + ","; |
| | | } |
| | | if (weekList.Contains("3")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.thursday) + ","; |
| | | } |
| | | if (weekList.Contains("4")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.friday) + ","; |
| | | } |
| | | if (weekList.Contains("5")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.saturday) + ","; |
| | | } |
| | | if (weekList.Contains("6")) |
| | | { |
| | | weekTextName += Language.StringByID(StringId.sunday) + ","; |
| | | } |
| | | if (weekTextName=="") { |
| | | return ""; |
| | | } |
| | | return weekTextName.TrimEnd(','); |
| | | } |
| | | } |
| | | } |