| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// </summary> |
| | | FrameLayout contentView; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 后退按钮 |
| | | /// </summary> |
| | |
| | | string title; |
| | | |
| | | /// <summary> |
| | | /// 是否需要关闭页面 |
| | | /// </summary> |
| | | bool needClose = true; |
| | | |
| | | /// <summary> |
| | | /// 后退时触发对事件 |
| | | /// </summary> |
| | | Action backAction; |
| | |
| | | { |
| | | baseView = frame; |
| | | title = str; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// TopViewDiv |
| | | /// </summary> |
| | | /// <param name="frame">父控件</param> |
| | | /// <param name="title">标题</param> |
| | | /// <param name="needClose">是否需要关闭页面</param> |
| | | public TopViewDiv(FrameLayout frame, string title, bool needClose) |
| | | { |
| | | baseView = frame; |
| | | this.title = title; |
| | | this.needClose = needClose; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | }; |
| | | baseView.AddChidren(contentView); |
| | | |
| | | btnBack = new Button() |
| | | Button btnBackIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealHeight(28), |
| | | Height = Application.GetRealWidth(28), |
| | | UnSelectedImagePath = "Public/BackIcon.png", |
| | | }; |
| | | baseView.AddChidren(btnBack); |
| | | contentView.AddChidren(btnBackIcon); |
| | | |
| | | Button btnTilte = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(30), |
| | | Width = Application.GetRealWidth(150), |
| | | Width = Application.GetRealWidth(270), |
| | | Height = Application.GetRealHeight(25), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.HeadlineFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Text = title |
| | | }; |
| | | baseView.AddChidren(btnTilte); |
| | | contentView.AddChidren(btnTilte); |
| | | |
| | | |
| | | btnBack = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(70), |
| | | }; |
| | | contentView.AddChidren(btnBack); |
| | | |
| | | LoadEventList(); |
| | | } |
| | | /// <summary> |
| | | /// 拥有一个回调事件 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public void LoadTopView(Action action) |
| | | /// <param name="backAct"></param> |
| | | public void LoadTopView(Action backAct) |
| | | { |
| | | backAction = action; |
| | | backAction = backAct; |
| | | |
| | | LoadTopView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 向framelayout添加顶部区域,拥有配置图标按钮 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="tilte"></param> |
| | | public void LoadTopView(Function function, Action action) |
| | | public void LoadTopView_RoomTop(Action backAction ,Action editAction) |
| | | { |
| | | backAction = action; |
| | | this.backAction = backAction; |
| | | |
| | | LoadTopView(); |
| | | |
| | |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "Public/FuncInfoSetIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnSetting); |
| | | |
| | | btnSetting.MouseUpEventHandler += (sender, e) => |
| | | //如果是成员隐藏编辑功能 |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | { |
| | | LoadEvent_SkipFunctionSetting(function); |
| | | contentView.AddChidren(btnSetting); |
| | | } |
| | | btnSetting.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | editAction(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 向framelayout添加顶部区域,拥有配置图标按钮 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="tilte"></param> |
| | | public void LoadTopView_FunctionTop(Function function, Action action) |
| | | { |
| | | backAction = action; |
| | | |
| | | LoadTopView(); |
| | | |
| | | var btnSetting = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(28), |
| | | Width = Application.GetMinRealAverage(32), |
| | | Height = Application.GetMinRealAverage(32), |
| | | UnSelectedImagePath = "Public/FuncInfoSetIcon.png", |
| | | }; |
| | | //如果是成员隐藏编辑功能 |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | { |
| | | contentView.AddChidren(btnSetting); |
| | | } |
| | | |
| | | btnSetting.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var infoView = new FunctionBaseInfoSetPage(function, action); |
| | | MainPage.BasePageView.AddChidren(infoView); |
| | | infoView.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 房间标题区域 |
| | | /// </summary> |
| | | /// <param name="room"></param> |
| | | /// <param name="skipAction"></param> |
| | | public void LoadTopView_SettingIcon(Action skipAction) |
| | | { |
| | | LoadTopView(); |
| | | |
| | | var btnSetting = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "Public/FuncInfoSetIcon.png", |
| | | }; |
| | | |
| | | //如果是成员隐藏编辑功能 |
| | | if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) |
| | | { |
| | | contentView.AddChidren(btnSetting); |
| | | } |
| | | |
| | | btnSetting.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | skipAction(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 向framelayout添加顶部区域,拥有添加图标的按钮 |
| | | /// </summary> |
| | | /// <param name="frame"></param> |
| | | /// <param name="tilte"></param> |
| | | public void LoadTopView(string type, Action<string, string> callBack) |
| | | public void LoadTopView_AddIcon(string type, Action<string, string> callBack) |
| | | { |
| | | LoadTopView(); |
| | | |
| | |
| | | |
| | | btnAddIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | LoadEvent_AddEvent(type, callBack); |
| | | |
| | | if (type == "floors") |
| | | { |
| | | Action<string> callBackAction = (floorName) => |
| | | { |
| | | callBack("add", floorName); |
| | | }; |
| | | string newFloorName = "1F"; |
| | | for (int i = 0; i < SpatialInfo.CurrentSpatial.FloorList.Count + 1;) |
| | | { |
| | | newFloorName = ++i + "F"; |
| | | if (null == SpatialInfo.CurrentSpatial.FloorList.Find((obj) => obj.roomName == newFloorName)) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | var fs = new List<string>(); |
| | | foreach (var f in SpatialInfo.CurrentSpatial.FloorList) |
| | | { |
| | | fs.Add(f.roomName); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors, newFloorName, callBackAction, StringId.FloorNameCannotBeEmpty, |
| | | StringId.AddFloorFailed_FloorAlreadyExist, fs); |
| | | } |
| | | else |
| | | { |
| | | callBack("", ""); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 向framelayout添加顶部区域,拥有添加图标的按钮,返回有回调事件 |
| | | /// 楼层管理顶部栏 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | /// <param name="callBack"></param> |
| | | /// <param name="action"></param> |
| | | public void LoadTopView(string type, Action<string, string> callBack,Action action) |
| | | public void LoadTopView_FloorTopView(Action<string> callBack,Action action) |
| | | { |
| | | LoadTopView(type, callBack); |
| | | LoadTopView(); |
| | | |
| | | backAction = action; |
| | | |
| | | var btnAddIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "Public/AddIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnAddIcon); |
| | | |
| | | btnAddIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | Action<string> callBackAction = (floorName) => |
| | | { |
| | | callBack(floorName); |
| | | }; |
| | | string newFloorName = "1F"; |
| | | for (int i = 0; i < SpatialInfo.CurrentSpatial.FloorList.Count + 1;) |
| | | { |
| | | newFloorName = ++i + "F"; |
| | | if (null == SpatialInfo.CurrentSpatial.FloorList.Find((obj) => obj.roomName == newFloorName)) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | var fs = new List<string>(); |
| | | foreach (var f in SpatialInfo.CurrentSpatial.FloorList) |
| | | { |
| | | fs.Add(f.roomName); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.AddFloors, newFloorName, callBackAction, StringId.FloorNameCannotBeEmpty, |
| | | StringId.AddFloorFailed_FloorAlreadyExist, fs); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 房间管理顶部栏 |
| | | /// </summary> |
| | | public void LoadTopView_RoomTopView(Action callBack) |
| | | { |
| | | LoadTopView(); |
| | | |
| | | var btnAddIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "Public/AddIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnAddIcon); |
| | | |
| | | btnAddIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | callBack?.Invoke(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 成员顶部栏 |
| | | /// </summary> |
| | | public void LoadTopView_MemberTopView(Action callBack, Action action) |
| | | { |
| | | LoadTopView(); |
| | | backAction = action; |
| | | |
| | | var btnAddIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "Public/AddIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnAddIcon); |
| | | |
| | | btnAddIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | addAction?.Invoke(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 安防中心顶部栏 |
| | | /// </summary> |
| | | public void LoadTopView_ArmCenter(Action skipAction)//(Action callBack, Action action) |
| | | { |
| | | LoadTopView(); |
| | | //backAction = action; |
| | | |
| | | var btnAddIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337), |
| | | Y = Application.GetRealHeight(29), |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/HistoryIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnAddIcon); |
| | | |
| | | btnAddIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | skipAction?.Invoke(); |
| | | }; |
| | | } |
| | | } |
| | | } |