| | |
| | | |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); |
| | | frameLayout.AddChidren(vv); |
| | | RefreshView(vv, false); |
| | | RefreshView(vv, false, control); |
| | | #endregion |
| | | |
| | | #region 界面点击事件 |
| | |
| | | topView.topIconBtn.Text = Language.StringByID(StringId.wancheng); |
| | | topView.topIconBtn.TextSize = TextSize.text14; |
| | | topView.topIconBtn.TextColor = CSS.CSS_Color.textColor; |
| | | RefreshView(vv, true); |
| | | RefreshView(vv, true, control); |
| | | } |
| | | else |
| | | { |
| | | topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png"; |
| | | topView.topIconBtn.Text = ""; |
| | | RefreshView(vv, false); |
| | | RefreshView(vv, false, control); |
| | | } |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="vv">上下滑动控件</param> |
| | | /// <param name="if_bool">表示是否显示删除图标</param> |
| | | void RefreshView(VerticalScrolViewLayout vv, bool if_bool) |
| | | void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control) |
| | | { |
| | | vv.RemoveAll(); |
| | | //定义一个变量记录行数 |
| | | int sum = 0; |
| | | if (Pir.BuottonList.Count % 3 == 0) |
| | | if (control.status.Count % 3 == 0) |
| | | { |
| | | sum = Pir.BuottonList.Count / 3; |
| | | sum = control.status.Count / 3; |
| | | } |
| | | else |
| | | { |
| | | sum = Pir.BuottonList.Count / 3 + 1; |
| | | sum = control.status.Count / 3 + 1; |
| | | } |
| | | //计算加载出来的数据需要的高度 |
| | | int h = 16 + sum * (16 + 44) + 104 + 76; |
| | |
| | | Height = Application.GetRealWidth(h), |
| | | }; |
| | | vv.AddChidren(FLayout); |
| | | for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++) |
| | | for (int i = 1, j = 0; i <= control.status.Count; i++, j++) |
| | | { |
| | | var nameObj = Pir.BuottonList[i - 1]; |
| | | var nameObj = control.status[i - 1]; |
| | | //按钮 |
| | | var buttonNameBtn = new Button |
| | | { |
| | |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | var buttonObj = Pir.BuottonList.Find((c) => c.value == obj.value); |
| | | var buttonObj = control.status.Find((c) => c.value == obj.value); |
| | | if (buttonObj != null) |
| | | { |
| | | Pir.BuottonList.Remove(buttonObj); |
| | | control.status.Remove(buttonObj); |
| | | } |
| | | RefreshView(vv, true); |
| | | RefreshView(vv, true, control); |
| | | } |
| | | else { |
| | | Method method = new Method(); |