| | |
| | | /// <param name="titleText"></param> |
| | | /// <param name="stateText">之前状态文本</param> |
| | | /// <param name="action">返回值</param> |
| | | public void SingleSelectionShow(FrameLayout frameLayout, List<string> list, string titleText, string stateText, Action<string> action) |
| | | /// <param name="textSize">显示文本字体大小</param> |
| | | public void SingleSelectionShow(FrameLayout frameLayout, List<string> list, string titleText, string stateText,Action<string> action, int textSize=LogicView.TextSize.text14) |
| | | { |
| | | LogicView.DateView view = new LogicView.DateView(); |
| | | view.btnTitle.Text = titleText; |
| | |
| | | string str = list[i]; |
| | | LogicView.CheckView checkView = new LogicView.CheckView(); |
| | | checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); |
| | | checkView.btnText.TextSize = textSize; |
| | | view.frameLayout.AddChidren(checkView.FLayoutView()); |
| | | checkView.btnText.Text = str; |
| | | checkView.btnClick.Tag = str;//标记 |
| | |
| | | /// <param name="titleText"></param> |
| | | /// <param name="stateTextList">之前状态文本</param> |
| | | /// <param name="action">返回值</param> |
| | | public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action) |
| | | /// <param name="textSize">显示文本字体大小</param> |
| | | public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14) |
| | | { |
| | | LogicView.DateView view = new LogicView.DateView(); |
| | | view.btnTitle.Text = titleText; |
| | |
| | | string str = list[i]; |
| | | LogicView.CheckView checkView = new LogicView.CheckView(); |
| | | checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i); |
| | | checkView.btnText.TextSize = textSize; |
| | | view.frameLayout.AddChidren(checkView.FLayoutView()); |
| | | checkView.btnText.Text = str; |
| | | checkView.btnClick.Tag = str;//标记 |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 月-多选择 |
| | | /// </summary> |
| | | /// <param name="frameLayout">父控件</param> |
| | | /// <param name="action">显示文本字体大小</param> |
| | | public void MonSelectShow(FrameLayout frameLayout,Logic logic, Action<List<string>> action) |
| | | { |
| | | LogicView.MonView monView = new LogicView.MonView(); |
| | | monView.btnTitle.TextID = StringId.monthly; |
| | | monView.FLayoutView(frameLayout); |
| | | monView.btnCancel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | monView.frameLayout.RemoveFromParent(); |
| | | }; |
| | | //定义一个局部monList列表用来记录选中数据; |
| | | List<string> monList = new List<string>(); |
| | | if (logic.cycle.type == "mon") |
| | | { |
| | | //加载之前保存的数据 |
| | | monList.AddRange(logic.cycle.value); |
| | | } |
| | | //定义一个变量记录行数 |
| | | int lineSun = 0; |
| | | for (int i = 1; i < 32; i++) |
| | | { |
| | | Button monTextBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(30), |
| | | Height = Application.GetRealWidth(30), |
| | | Radius = (uint)Application.GetRealWidth(15), |
| | | Text = i.ToString(), |
| | | TextSize = LogicView.TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | SelectedTextColor = CSS.CSS_Color.view, |
| | | SelectedBackgroundColor = CSS.CSS_Color.textConfirmColor, |
| | | BackgroundColor = CSS.CSS_Color.viewTranslucence, |
| | | Tag = i, |
| | | }; |
| | | monView.frameLayout.AddChidren(monTextBtn); |
| | | if (lineSun > 0) |
| | | { |
| | | monTextBtn.X = Application.GetRealWidth(16 + ((i - 1) - lineSun * 7) * 46); |
| | | } |
| | | else |
| | | { |
| | | |
| | | monTextBtn.X = Application.GetRealWidth(16 + (i - 1) * 46); |
| | | } |
| | | monTextBtn.Y = Application.GetRealWidth(58 + 10 + lineSun * (30 + 10)); |
| | | |
| | | if (i % 7 == 0) |
| | | { |
| | | //一定执行完再判断是否要换行. |
| | | lineSun = lineSun + 1; |
| | | |
| | | } |
| | | monTextBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | string clickIndex = monTextBtn.Tag.ToString(); |
| | | monTextBtn.IsSelected = !monTextBtn.IsSelected; |
| | | if (monTextBtn.IsSelected) |
| | | { |
| | | monTextBtn.IsSelected = true; |
| | | if (!monList.Contains(clickIndex)) |
| | | { |
| | | //添加选中数据 |
| | | monList.Add(clickIndex); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | monTextBtn.IsSelected = false; |
| | | if (monList.Contains(clickIndex)) |
| | | { |
| | | //移除选中数据 |
| | | monList.Remove(clickIndex); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | if (monList.Contains(i.ToString())) |
| | | { |
| | | monTextBtn.IsSelected = true; |
| | | } |
| | | } |
| | | //确定点击事件 |
| | | monView.btnConfirm.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (monList.Count == 0) |
| | | { |
| | | //提示:还没选中执行周期 |
| | | return; |
| | | } |
| | | |
| | | |
| | | action(monList); |
| | | frameLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |