| | |
| | | { |
| | | Tag = "PirView"; |
| | | } |
| | | public void Show() { |
| | | public void Show() |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | PirDevice.View.TopView topView = new View.TopView(); |
| | |
| | | topView.topIconBtn.Visible = true; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout(); |
| | | VerticalRefreshLayout vv = new VerticalRefreshLayout(); |
| | | vv.Height = Application.GetRealHeight(667 - 64); |
| | | vv.Y = Application.GetRealHeight(64); |
| | | this.AddChidren(vv); |
| | | vv.BeginHeaderRefreshingAction += () => |
| | | { |
| | | //关闭刷新View; |
| | | vv.EndHeaderRefreshing(); |
| | | //获取列表 |
| | | Method.GetPirDeviceList(this,() => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //刷新界面 |
| | | UIView(vv); |
| | | }); |
| | | }); |
| | | |
| | | }; |
| | | #endregion |
| | | UIView(vv); |
| | | |
| | |
| | | /// 加载UI界面 |
| | | /// </summary> |
| | | /// <param name="vv">上下滑控件</param> |
| | | void UIView(VerticalScrolViewLayout vv) { |
| | | void UIView(VerticalRefreshLayout vv) |
| | | { |
| | | vv.RemoveAll(); |
| | | int a = 3; |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirDevice = Pir.pirDeviceList[i]; |
| | | #region 红外宝图标 版本号 名称 状态 |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(375), |
| | | Height = Application.GetRealHeight(12 + 92 + (50 * a)), |
| | | Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)), |
| | | }; |
| | | vv.AddChidren(fLayout); |
| | | |
| | |
| | | Y = Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = Application.GetRealHeight(92 + (50 * a)), |
| | | Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | Radius = (uint)Application.GetRealHeight(12), |
| | | }; |
| | |
| | | X = priequipmentBtn.Right + Application.GetRealWidth(7), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = "红外宝A" + i.ToString(), |
| | | Text = pirDevice.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | |
| | | X = priequipmentBtn.Right + Application.GetRealWidth(7), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(17), |
| | | Text = "2", |
| | | Text = pirDevice.FunctioList.Count.ToString(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text12, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = Application.GetRealHeight(92), |
| | | BackgroundColor = CSS.CSS_Color.view, |
| | | BackgroundColor = 0x00000000, //CSS.CSS_Color.view, |
| | | Radius = (uint)Application.GetRealHeight(12), |
| | | Tag = Pir.pirDeviceList[i], |
| | | }; |
| | | fLayout.AddChidren(clickFram); |
| | | |
| | | clickFram.MouseUpEventHandler += (sender, e) => { |
| | | clickFram.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var pirclick = (clickFram.Tag as Pir); |
| | | NewSwitchView( pirclick, vv); |
| | | NewSwitchView(pirclick, vv); |
| | | }; |
| | | |
| | | if (Pir.pirDeviceList.Count - 1 == i) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | for (int j = 0; j < a; j++) |
| | | for (int j = 0; j < pirDevice.FunctioList.Count; j++) |
| | | { |
| | | var control = pirDevice.FunctioList[i]; |
| | | RowLayout funControlRow = new RowLayout |
| | | { |
| | | Y = Application.GetRealHeight(92 + (50 * j)), |
| | |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(20), |
| | | Text = j.ToString(), |
| | | Text = control.name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | |
| | | TextColor = CSS.CSS_Color.textWhiteColor, |
| | | IsBold = true, |
| | | BackgroundColor = CSS.CSS_Color.textRedColor, |
| | | Tag = control, |
| | | }; |
| | | funControlRow.AddRightView(delBtn); |
| | | //线 |
| | |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | }; |
| | | funControlRow.AddChidren(line1Btn); |
| | | if (j == a - 1) |
| | | if (j == pirDevice.FunctioList.Count - 1) |
| | | { |
| | | //最后改变一个线的颜色 |
| | | line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; |
| | | funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; |
| | | } |
| | | delBtn.MouseUpEventHandler += (sender, e) => { |
| | | delBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | var Function = delBtn.Tag as Entity.Function; |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; |
| | | loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | responsePackNew = PirSend.DeleteDevice(Function.deviceId); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | try |
| | | { |
| | | if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | pirDevice.FunctioList.Remove(Function); |
| | | UIView(vv); |
| | | } |
| | | |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | } |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="pirclick"></param> |
| | | /// <param name="vv"></param> |
| | | void NewSwitchView(Pir pirclick,VerticalScrolViewLayout vv) { |
| | | void NewSwitchView(Pir pirclick, VerticalRefreshLayout vv) |
| | | { |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | SwitchView switchView = new SwitchView(); |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | }, () => { |
| | | }, () => |
| | | { |
| | | NewSwitchView(pirclick, vv); |
| | | }, false); |
| | | |
| | |
| | | { |
| | | string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?"; |
| | | TipPopView tipPopView = new TipPopView(); |
| | | tipPopView.TipBox(StringId.tip, text, (dialog) => { |
| | | tipPopView.TipBox(StringId.tip, text, (dialog) => |
| | | { |
| | | //加载log |
| | | Loading loading = new Loading(); |
| | | dialog.AddChidren(loading); |
| | |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }, () => { |
| | | }, () => |
| | | { |
| | | NewSwitchView(pirclick, vv); |
| | | }, false); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |