using System; using System.Collections.Generic; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class TopViewDiv { /// /// 父窗体 /// FrameLayout baseView; /// /// 父窗体Dialog /// Dialog baseDialog; /// /// 内容区域 /// FrameLayout contentView; /// /// 后退按钮 /// Button btnBack; /// /// 标题名称 /// string title; /// /// 是否需要关闭页面 /// bool needClose = true; /// /// 后退时触发对事件 /// Action backAction; public TopViewDiv(FrameLayout frame, string str) { baseView = frame; title = str; } /// /// TopViewDiv /// /// 父控件 /// 标题 /// 是否需要关闭页面 public TopViewDiv(FrameLayout frame, string title, bool needClose) { baseView = frame; this.title = title; this.needClose = needClose; } /// /// /// /// 显示的dialog /// dialog的父窗体 /// 标题文本 public TopViewDiv(Dialog dialog, FrameLayout frame, string str) { baseDialog = dialog; baseView = frame; title = str; } /// /// 向framelayout添加顶部区域 /// /// /// public void LoadTopView() { contentView = new FrameLayout() { Height = Application.GetRealHeight(64), BackgroundColor = CSS_Color.TopViewColor, }; baseView.AddChidren(contentView); Button btnBackIcon = new Button() { X = Application.GetRealWidth(10), Y = Application.GetRealHeight(29), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(28), UnSelectedImagePath = "Public/BackIcon.png", }; contentView.AddChidren(btnBackIcon); btnBack = new Button() { Width = Application.GetRealWidth(100), }; contentView.AddChidren(btnBack); Button btnTilte = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(30), Width = Application.GetRealWidth(270), Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.HeadlineFontSize, TextColor = CSS_Color.FirstLevelTitleColor, Text = title }; contentView.AddChidren(btnTilte); LoadEventList(); } /// /// 拥有一个回调事件 /// /// public void LoadTopView(Action backAct) { backAction = backAct; LoadTopView(); } public void LoadTopView_RoomTop(Action backAction ,Action editAction) { this.backAction = backAction; 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.IsOthreShare) { contentView.AddChidren(btnSetting); } btnSetting.MouseUpEventHandler = (sender, e) => { editAction(); }; } /// /// 向framelayout添加顶部区域,拥有配置图标按钮 /// /// /// 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.IsOthreShare) { 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; }; } /// /// 房间标题区域 /// /// /// 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.IsOthreShare) { contentView.AddChidren(btnSetting); } btnSetting.MouseUpEventHandler += (sender, e) => { skipAction(); }; } /// /// 向framelayout添加顶部区域,拥有添加图标的按钮 /// /// /// public void LoadTopView_AddIcon(string type, 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) => { LoadEvent_AddEvent(type, callBack); }; } /// /// 楼层管理顶部栏 /// public void LoadTopView_FloorTopView(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) => { Action 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(); 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); }; } /// /// 房间管理顶部栏 /// 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(); }; } /// /// 成员顶部栏 /// 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) => { callBack?.Invoke(); }; } } }