File was renamed from ZigbeeApp/Shared/Phone/UserCenter/Safety/SensorDeviceSettionListForm.cs |
| | |
| | | /// <summary>
|
| | | /// 已经设置了的传感器的一览画面
|
| | | /// </summary>
|
| | | public class SensorDeviceSettionListForm : EditorCommonForm
|
| | | public class GarrisonAreaExistSensorForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | |
| | | this.AddNewSensorDevice();
|
| | | };
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView.Y = Application.GetRealHeight(-6);
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | //初始化传感器列表信息
|
| | | this.InitSensorDevicesListInfo();
|
| | | }
|
| | |
| | | /// </summary>
|
| | | private void InitSensorDevicesListInfo()
|
| | | {
|
| | | this.listView.RemoveAll();
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | //清空bodyFrameLayout
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //获取指定防区全部的传感器设备的信息
|
| | | var listInfo = HdlSafeguardLogic.Current.GetSensorDevicesInfoByZoonID(this.zoonID);
|
| | | if (listInfo.Count == 0)
|
| | | {
|
| | | //还没有设置传感器哦
|
| | | this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDoNotHadSettionSensorMsg));
|
| | | this.listView = null;
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | |
|
| | | listView = new VerticalListControl(29);
|
| | | listView.Y = Application.GetRealHeight(-6);
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | int count = listInfo.Count - 1;
|
| | | for (int i = 0; i < listInfo.Count; i++)
|
| | | {
|
| | | int count = listInfo.Count - 1;
|
| | | for (int i = 0; i < listInfo.Count; i++)
|
| | | {
|
| | | if (this.Parent != null)
|
| | | {
|
| | | this.AddRowLayout(listInfo[i], i != count);
|
| | | }
|
| | | }
|
| | | if (listView.ChildrenCount == 0)
|
| | | {
|
| | | //没有合法的传感器
|
| | | return;
|
| | | }
|
| | | //调整列表控件的高度
|
| | | this.AdjustListviewHeight();
|
| | | });
|
| | | this.AddRowLayout(listInfo[i], i != count);
|
| | | }
|
| | | //调整列表控件的高度
|
| | | this.listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | /// <param name="device"></param>
|
| | | private async void DeleteRow(DeviceRoomControl rowLayout, CommonDevice device)
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | | bool result = await HdlSafeguardLogic.Current.DeleteSensorDevice(this.zoonID, new List<CommonDevice>() { device });
|
| | |
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | //从画面中移除
|
| | | rowLayout?.RemoveFromParent();
|
| | | //调整列表控件的高度
|
| | | this.listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | if (this.listView.ChildrenCount == 0)
|
| | | {
|
| | | //从画面中移除
|
| | | rowLayout?.RemoveFromParent();
|
| | | //调节列表控件的高度
|
| | | this.AdjustListviewHeight();
|
| | | });
|
| | | //初始化传感器列表信息
|
| | | this.InitSensorDevicesListInfo();
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | if (listDevice.Count == 0)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //关闭界面
|
| | | form.CloseForm();
|
| | | });
|
| | | //关闭界面
|
| | | form.CloseForm();
|
| | | return;
|
| | | }
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | | //添加设备到安防
|
| | | bool success = await HdlSafeguardLogic.Current.AddSensorDevice(this.zoonID, listDevice);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | if (success == true)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //关闭界面
|
| | | form.CloseForm();
|
| | | });
|
| | | //关闭界面
|
| | | form.CloseForm();
|
| | | //刷新列表
|
| | | this.InitSensorDevicesListInfo();
|
| | | }
|
| | |
| | | listNew.Add(device);
|
| | | }
|
| | | return listNew;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 调节列表控件的高度
|
| | | /// </summary>
|
| | | private void AdjustListviewHeight()
|
| | | {
|
| | | if (listView.ChildrenCount == 0)
|
| | | {
|
| | | //直接拉满屏幕
|
| | | listView.Height = bodyFrameLayout.Height + Application.GetRealHeight(6);
|
| | | return;
|
| | | }
|
| | | var realHeight = listView.ChildrenCount * listView.GetChildren(listView.ChildrenCount - 1).Height;
|
| | | realHeight += listView.rowSpace;
|
| | | if (realHeight < listView.Height)
|
| | | {
|
| | | //缩小控件高度
|
| | | listView.Height = realHeight;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|