| | |
| | | /// <summary>
|
| | | /// 添加场景的列表界面
|
| | | /// </summary>
|
| | | public class AddSceneAlarmTargetListForm : UserCenterCommonForm
|
| | | public class AddSceneAlarmTargetListForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 列表控件
|
| | | /// </summary>
|
| | | private VerticalScrolViewLayout listView = null;
|
| | | private VerticalListControl listView = null;
|
| | | /// <summary>
|
| | | /// 防区ID(这个东西似乎是唯一的)
|
| | | /// </summary>
|
| | | private int zoonID = 0;
|
| | | /// <summary>
|
| | | /// 本地存在的场景
|
| | | /// </summary>
|
| | | private List<Common.SceneRoomUI> listScene = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | |
| | | public void ShowForm(int i_zoonID, List<Common.SceneRoomUI> i_listScene)
|
| | | {
|
| | | this.zoonID = i_zoonID;
|
| | | this.listScene = i_listScene;
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uScence));
|
| | |
|
| | | //完成
|
| | | var btnfinish = new TopLayoutFinshView();
|
| | | topFrameLayout.AddChidren(btnfinish); |
| | | btnfinish.MouseUpEventHandler += (sender, e) => |
| | | {
|
| | | //保存场景到安防
|
| | | this.SaveSceneToSafety();
|
| | | };
|
| | |
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | this.InitMiddleFrame(i_listScene);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | /// <param name="listScene">现存的场景</param>
|
| | | private void InitMiddleFrame(List<Common.SceneRoomUI> listScene)
|
| | | {
|
| | | //场景列表
|
| | | var btnTitle = new TitleViewControl();
|
| | | btnTitle.TextColor = UserCenterColor.Current.TextGrayColor;
|
| | | btnTitle.Y = Application.GetRealHeight(60);
|
| | | btnTitle.Text = Language.StringByID(R.MyInternationalizationString.uScence) + Language.StringByID(R.MyInternationalizationString.uList);
|
| | | bodyFrameLayout.AddChidren(btnTitle);
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | this.listView = new VerticalScrolViewLayout();
|
| | | this.listView.Y = btnTitle.Bottom;
|
| | | this.listView.Height = bodyFrameLayout.Height - btnTitle.Bottom;
|
| | | bodyFrameLayout.AddChidren(this.listView);
|
| | | //完成
|
| | | var btnfinish = new BottomClickButton();
|
| | | btnfinish.TextID = R.MyInternationalizationString.uFinish;
|
| | | bodyFrameLayout.AddChidren(btnfinish); |
| | | btnfinish.ButtonClickEvent += (sender, e) => |
| | | {
|
| | | //保存场景到安防
|
| | | this.SaveSceneToSafety();
|
| | | };
|
| | |
|
| | | new System.Threading.Thread(() =>
|
| | | this.listView = new VerticalListControl(29);
|
| | | listView.Y = Application.GetRealHeight(-6);
|
| | | listView.Height = btnfinish.Y - ControlCommonResourse.BottomButtonAndListViewSpace + Application.GetRealHeight(6);
|
| | | listView.BackgroundColor = UserCenterColor.Current.White;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取本地安防的场景
|
| | | Dictionary<int, string> dicScene = Common.LocalSafeguard.Current.GetLocalSceneByZoneID(this.zoonID);
|
| | | foreach (var scene in this.listScene)
|
| | | Dictionary<int, string> dicScene = HdlSafeguardLogic.Current.GetLocalSceneByZoneID(this.zoonID);
|
| | | if (this.Parent == null)
|
| | | {
|
| | | //如果安防里面已经添加有,则不再显示
|
| | | if (dicScene.ContainsKey(scene.sceneUI.Id) == true)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //添加场景行
|
| | | this.AddSceneRowLayout(scene);
|
| | | });
|
| | | return;
|
| | | }
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | int count = listScene.Count - 1;
|
| | | for (int i = 0; i < listScene.Count; i++)
|
| | | {
|
| | | //如果安防里面已经添加有,则不再显示
|
| | | if (dicScene.ContainsKey(listScene[i].sceneUI.Id) == true)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var row = new SceneSimpleSelectControl(listScene[i].sceneUI, listView.rowSpace / 2);
|
| | | listView.AddChidren(row);
|
| | | row.InitControl();
|
| | | if (i != count)
|
| | | {
|
| | | //底线
|
| | | row.AddBottomLine();
|
| | | }
|
| | | }
|
| | | if (listView.ChildrenCount > 0)
|
| | | {
|
| | | int realHeight = (listView.GetChildren(listView.ChildrenCount - 1).Height) * listView.ChildrenCount + Application.GetRealHeight(23);
|
| | | if (realHeight < listView.Height)
|
| | | {
|
| | | //调整真实高度
|
| | | listView.Height = realHeight;
|
| | | }
|
| | | }
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 添加场景行
|
| | | /// </summary>
|
| | | /// <param name="i_Scene"></param>
|
| | | private void AddSceneRowLayout(Common.SceneRoomUI i_Scene)
|
| | | {
|
| | | var row = new SceneSelectRow(this.listView, i_Scene);
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 保存场景___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 保存场景到安防
|
| | |
| | | {
|
| | | break;
|
| | | }
|
| | | var row = (SceneSelectRow)myView;
|
| | | var row = (SceneSimpleSelectControl)myView;
|
| | | if (row.IsSelected == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | var actionObj = new Safeguard.AlarmActionObj();
|
| | | actionObj.Type = 1;
|
| | | actionObj.ScenesId = row.sceneRoomUI.sceneUI.Id;
|
| | | actionObj.ScenesId = row.Scene.Id;
|
| | | listAction.Add(actionObj);
|
| | | }
|
| | | if (listAction.Count == 0)
|
| | |
| | | this.ShowProgressBar();
|
| | |
|
| | | //添加报警目标到安防
|
| | | bool success = await Common.LocalSafeguard.Current.AddAlarmTagetToSafety(this.zoonID, listAction);
|
| | | bool success = await HdlSafeguardLogic.Current.AddAlarmTagetToSafety(this.zoonID, listAction);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | |
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //刷新一览画面
|
| | | this.LoadFormMethodByName("AlarmTargetSettionForm", "SetMiddleInfo");
|
| | | //关闭自身
|
| | | this.CloseForm();
|
| | | });
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|