| | |
| | | using DevExpress.Utils.Svg; |
| | | using DevExpress.XtraBars.Docking; |
| | | using DevExpress.XtraBars.Docking2010.Views; |
| | | using DevExpress.XtraBars.Navigation; |
| | | using DevExpress.XtraBars.Ribbon; |
| | | using DevExpress.XtraEditors; |
| | | using HStation.WinFrmUI.PBS; |
| | | using DevExpress.XtraTab; |
| | | using DevExpress.XtraTab.ViewInfo; |
| | | using HStation.WinFrmUI.Xhs.PumpProduct; |
| | | using System.Drawing.Drawing2D; |
| | | using System.IO; |
| | | using Yw.WinFrmUI; |
| | | using Yw.WinFrmUI.Page; |
| | |
| | | public MainForm() |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | this.accordionControlFunction.GroupHeight = 50; |
| | | this.accordionControlFunction.ItemHeight = 35; |
| | | this.accordionControlFunction.Appearance.Group.Default.Font = new Font("微软雅黑", 10.5f); |
| | | this.accordionControlFunction.Appearance.Item.Default.Font = new Font("微软雅黑", 9.5f); |
| | | this.accordionControlFunction.AllowItemSelection = true; |
| | | |
| | | this.accordionControlFunction.Appearance.AccordionControl.BackColor = Color.White; |
| | | this.accordionControlFunction.Appearance.AccordionControl.BorderColor = Color.White; |
| | | this.accordionControlFunction.AllowHtmlText = true; |
| | | this.accordionControlFunction.HtmlTemplates.HamburgerHeaderPanel.Template = @"<div class='hamburger-header-background'></div>"; |
| | | this.accordionControlFunction.HtmlTemplates.HamburgerHeaderPanel.Styles = @".hamburger-header-background {background-color: #ffffff; height: 100%;width: 100%;}"; |
| | | |
| | | this.xtraTabContrl.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | } |
| | | |
| | | HatchBrush myHatchBrush1 = new HatchBrush(HatchStyle.BackwardDiagonal, Color.LightGray, Color.AliceBlue); |
| | | private void TabbedView1_CustomDrawTabHeader(object sender, DevExpress.XtraTab.TabHeaderCustomDrawEventArgs e) |
| | | { |
| | | e.Cache.FillRectangle(myHatchBrush1, e.Bounds); |
| | | e.DefaultDrawText(); |
| | | e.DefaultDrawImage(); |
| | | e.DefaultDrawButtons(); |
| | | e.Handled = true; |
| | | } |
| | | |
| | | #region TileNavPane 相关处理 |
| | |
| | | } |
| | | this.DragMove(); |
| | | } |
| | | } |
| | | |
| | | //标题点击 |
| | | private void nbTitle_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | } |
| | | |
| | | //最大化最小化窗体 |
| | |
| | | //功能点击事件 |
| | | private void tileNavPane_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var item = e.Element as NavButton; |
| | | if (item.Tag != null) |
| | | { |
| | | if (item.Tag is string) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region Menu |
| | | |
| | | private Control _place_mgr_ctrl = null;//场所管理弹出界面 |
| | | private Control _equivalent_mgr_ctrl = null;//当量管理弹出界面 |
| | | private Control _asste_mgr_ctrl = null;//产品管理弹出界面 |
| | | private Control _system_config_ctrl = null;//系统配置弹出界面 |
| | | private Control _auth_config_ctrl = null;//权限配置弹出界面 |
| | | |
| | | //首页 |
| | | private void nbTitle_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = "PBS", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "Home" |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | //场所管理 |
| | | private void nbPlaceMgr_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var pt = this.tileNavPane.PointToClient(MousePosition); |
| | | var hit_info = this.tileNavPane.CalcHitInfo(pt); |
| | | if (hit_info == null) |
| | | if (e.Element is not NavButton btn) |
| | | return; |
| | | if (_place_mgr_ctrl == null) |
| | | { |
| | | var peek_item_list = new List<Yw.WinFrmUI.TilePeekItem>() |
| | | { |
| | | new() |
| | | { |
| | | Caption="行政区域", |
| | | SvgImage=svgImg32[0], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Place", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="DistrictMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="场所建筑", |
| | | SvgImage=svgImg32[1], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Place", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="PlaceMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | var test=new PlaceMgrPage(); |
| | | test.PageGuid=guid; |
| | | test.PageTitle.Caption="场所建筑"; |
| | | test.PageTitle.HeaderSvgImage=svgImg32[1]; |
| | | test.PageTitle.SvgImageSize=new Size(20,20); |
| | | CreatePage(test,guid); |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="场所设施", |
| | | SvgImage=svgImg32[2], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Place", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="FacilityMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, |
| | | //new TilePeekItem(){ |
| | | // Caption="场所分区", |
| | | // SvgImage=svgImg32[3], |
| | | // SvgImageSize=new Size(24,24), |
| | | // Click=()=>{ |
| | | // this.flyoutPanel1.HideBeakForm(); |
| | | // var guid=new PageGuid(){ |
| | | // Modular="Place", |
| | | // MoudingType=eMoudingType.Tab, |
| | | // Function="RegionMgr", |
| | | // }; |
| | | // if(!IsExistPage(guid,true)) |
| | | // { |
| | | |
| | | // } |
| | | // } |
| | | //}, |
| | | }; |
| | | _place_mgr_ctrl = peek_item_list.CreatePeekCtrl(); |
| | | } |
| | | |
| | | this.flyoutPanel1.Size = _place_mgr_ctrl.Size; |
| | | this.flyoutPanelControl1.Controls.Clear(); |
| | | this.flyoutPanelControl1.Controls.Add(_place_mgr_ctrl); |
| | | var rectangle = this.RectangleToScreen(hit_info.ButtonInfo.Bounds); |
| | | this.flyoutPanel1.ShowBeakForm(rectangle); |
| | | |
| | | } |
| | | |
| | | //当量管理 |
| | | private void nbWEMgr_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var pt = this.tileNavPane.PointToClient(MousePosition); |
| | | var hit_info = this.tileNavPane.CalcHitInfo(pt); |
| | | if (hit_info == null) |
| | | if (!btn.Enabled) |
| | | return; |
| | | if (_equivalent_mgr_ctrl == null) |
| | | { |
| | | var peek_item_list = new List<Yw.WinFrmUI.TilePeekItem>() |
| | | { |
| | | new() |
| | | { |
| | | Caption="用水器具", |
| | | SvgImage=svgImg32[4], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="WE", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="WaterUtensilMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="用水当量", |
| | | SvgImage=svgImg32[5], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="WE", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="WaterWEMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _equivalent_mgr_ctrl = peek_item_list.CreatePeekCtrl(); |
| | | } |
| | | |
| | | this.flyoutPanel1.Size = _equivalent_mgr_ctrl.Size; |
| | | this.flyoutPanelControl1.Controls.Clear(); |
| | | this.flyoutPanelControl1.Controls.Add(_equivalent_mgr_ctrl); |
| | | var rectangle = this.RectangleToScreen(hit_info.ButtonInfo.Bounds); |
| | | this.flyoutPanel1.ShowBeakForm(rectangle); |
| | | } |
| | | |
| | | //产品管理 |
| | | private void nbAssetManage_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var pt = this.tileNavPane.PointToClient(MousePosition); |
| | | var hit_info = this.tileNavPane.CalcHitInfo(pt); |
| | | if (hit_info == null) |
| | | if (btn.Tag is not string tag) |
| | | return; |
| | | if (_asste_mgr_ctrl == null) |
| | | PageGuid pguid = null; |
| | | if (this.xtraTabContrl.SelectedTabPage != null) |
| | | { |
| | | var peek_item_list = new List<Yw.WinFrmUI.TilePeekItem>() |
| | | { |
| | | new TilePeekItem(){ |
| | | Caption="厂商管理", |
| | | SvgImage=svgImg32[6], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Asste", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="AssetsManufacturerMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="水泵管理", |
| | | SvgImage=svgImg32[7], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Asste", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="AssetsPumpMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="成套设备", |
| | | SvgImage=svgImg32[8], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Asste", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="AssetsKitMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _asste_mgr_ctrl = peek_item_list.CreatePeekCtrl(); |
| | | pguid = this.xtraTabContrl.SelectedTabPage.Tag as PageGuid; |
| | | } |
| | | this.flyoutPanel1.Size = _asste_mgr_ctrl.Size; |
| | | this.flyoutPanelControl1.Controls.Clear(); |
| | | this.flyoutPanelControl1.Controls.Add(_asste_mgr_ctrl); |
| | | var rectangle = this.RectangleToScreen(hit_info.ButtonInfo.Bounds); |
| | | this.flyoutPanel1.ShowBeakForm(rectangle); |
| | | |
| | | SelectModular(tag, pguid); |
| | | } |
| | | |
| | | //系统配置 |
| | | private void nbSystemConfig_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var pt = this.tileNavPane.PointToClient(MousePosition); |
| | | var hit_info = this.tileNavPane.CalcHitInfo(pt); |
| | | if (hit_info.ButtonInfo == null) |
| | | return; |
| | | if (_system_config_ctrl == null) |
| | | { |
| | | var peek_item_list = new List<Yw.WinFrmUI.TilePeekItem>() |
| | | { |
| | | new TilePeekItem(){ |
| | | Caption="类型管理", |
| | | SvgImage=svgImg32[9], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="System", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="SystemTypeMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="分类管理", |
| | | SvgImage=svgImg32[10], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="System", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="SystemCatalogMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | |
| | | } |
| | | } |
| | | }, new TilePeekItem(){ |
| | | Caption="属性管理", |
| | | SvgImage=svgImg32[11], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="System", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="SystemPropMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="字典类型", |
| | | SvgImage=svgImg32[12], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="System", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="SystemDictMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | _system_config_ctrl = peek_item_list.CreatePeekCtrl(); |
| | | } |
| | | this.flyoutPanel1.Size = _system_config_ctrl.Size; |
| | | this.flyoutPanelControl1.Controls.Clear(); |
| | | this.flyoutPanelControl1.Controls.Add(_system_config_ctrl); |
| | | var rectangle = this.RectangleToScreen(hit_info.ButtonInfo.Bounds); |
| | | this.flyoutPanel1.ShowBeakForm(rectangle); |
| | | |
| | | } |
| | | |
| | | //权限配置 |
| | | private void nbAuthConfig_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | var pt = this.tileNavPane.PointToClient(MousePosition); |
| | | var hit_info = this.tileNavPane.CalcHitInfo(pt); |
| | | if (hit_info.ButtonInfo != null) |
| | | { |
| | | if (_auth_config_ctrl == null) |
| | | { |
| | | var peek_item_list = new List<Yw.WinFrmUI.TilePeekItem>() |
| | | { |
| | | new TilePeekItem(){ |
| | | Caption="角色管理", |
| | | SvgImage=svgImg32[13], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Auth", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="RoleMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="用户管理", |
| | | SvgImage=svgImg32[14], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Auth", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="UserMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | }, |
| | | new TilePeekItem(){ |
| | | Caption="菜单管理", |
| | | SvgImage=svgImg32[15], |
| | | SvgImageSize=new Size(24,24), |
| | | Click=()=>{ |
| | | this.flyoutPanel1.HideBeakForm(); |
| | | var guid=new PageGuid(){ |
| | | Modular="Auth", |
| | | MoudingType=eMoudingType.Tab, |
| | | Function="MenuMgr", |
| | | }; |
| | | if(!IsExistPage(guid,true)) |
| | | { |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | _auth_config_ctrl = peek_item_list.CreatePeekCtrl(); |
| | | } |
| | | this.flyoutPanel1.Size = _auth_config_ctrl.Size; |
| | | this.flyoutPanelControl1.Controls.Clear(); |
| | | this.flyoutPanelControl1.Controls.Add(_auth_config_ctrl); |
| | | var rectangle = this.RectangleToScreen(hit_info.ButtonInfo.Bounds); |
| | | this.flyoutPanel1.ShowBeakForm(rectangle); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion TileNavPane 相关处理 |
| | | |
| | |
| | | //界面显示事件 |
| | | private void MainForm_Shown(object sender, EventArgs e) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = "PBS", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "Home" |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | /* var page = new HomePBSProjectPage(); |
| | | //var page = new HomePBSProjectPage(); |
| | | CreatePage(page, guid);*/ |
| | | } |
| | | //var guid = new PageGuid() |
| | | //{ |
| | | // Modular = "PBS", |
| | | // MoudingType = eMoudingType.Tab, |
| | | // Function = "Home" |
| | | //}; |
| | | //if (!IsExistPage(guid, true)) |
| | | //{ |
| | | //} |
| | | |
| | | SelectModular("BasicData"); |
| | | } |
| | | |
| | | //界面正在退出时确认 |
| | |
| | | #region TabbedView 相关事件处理程序 |
| | | |
| | | //选中 |
| | | private void tabbedView1_DocumentSelected(object sender, DocumentEventArgs e) |
| | | private void xtraTabContrl_SelectedPageChanged(object sender, TabPageChangedEventArgs e) |
| | | { |
| | | if (e.Document == null) |
| | | if (e.Page == null) |
| | | return; |
| | | var surfaceGuid = e.Document.Tag as PageGuid; |
| | | if (surfaceGuid == null) |
| | | var pguid = e.Page.Tag as PageGuid; |
| | | if (pguid == null) |
| | | return; |
| | | SelectModular(surfaceGuid.Modular, surfaceGuid); |
| | | SelectModular(pguid.Modular, pguid); |
| | | } |
| | | |
| | | //添加 |
| | | private void tabbedView1_DocumentAdded(object sender, DocumentEventArgs e) |
| | | //关闭 |
| | | private void xtraTabContrl_CloseButtonClick(object sender, EventArgs e) |
| | | { |
| | | if (this.tabbedView1.Documents.Count > 1) |
| | | var arg = e as ClosePageButtonEventArgs; |
| | | var last_index = this.xtraTabContrl.SelectedTabPageIndex - 1; |
| | | this.xtraTabContrl.TabPages.Remove(arg.Page as XtraTabPage); |
| | | if (last_index > 0) |
| | | { |
| | | if (!this.tabbedView1.DocumentGroupProperties.ShowTabHeader) |
| | | { |
| | | |
| | | } |
| | | this.xtraTabContrl.SelectedTabPageIndex = last_index; |
| | | } |
| | | } |
| | | |
| | | //激活 |
| | | private void tabbedView1_DocumentActivated(object sender, DocumentEventArgs e) |
| | | { |
| | | var page = e.Document.Control as DocumentPage; |
| | | if (page == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | //关闭 此时控件已经为空 |
| | | private void tabbedView1_DocumentClosed(object sender, DocumentEventArgs e) |
| | | { |
| | | } |
| | | |
| | | #endregion TabbedView 相关事件处理程序 |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) |
| | | if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) |
| | | { |
| | | foreach (BaseDocument doc in this.tabbedView1.Documents) |
| | | foreach (XtraTabPage doc in this.xtraTabContrl.TabPages) |
| | | { |
| | | if (doc.Tag != null) |
| | | { |
| | |
| | | { |
| | | if (isActivePage) |
| | | { |
| | | this.tabbedView1.Controller.Activate(doc); |
| | | this.xtraTabContrl.SelectedTabPage = doc; |
| | | } |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) |
| | | if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) |
| | | { |
| | | var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | if (doc != null) |
| | | { |
| | | var page = doc.Control as DocumentPage; |
| | | var page = doc.Controls[0] as DocumentPage; |
| | | if (page != null) |
| | | { |
| | | page.RefreshData(); |
| | |
| | | } |
| | | } |
| | | |
| | | if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) |
| | | if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) |
| | | { |
| | | var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | if (doc != null) |
| | | { |
| | | doc.Caption = title.Caption; |
| | | doc.Text = title.Caption; |
| | | doc.ImageOptions.Image = title.HeaderImage; |
| | | doc.ImageOptions.SvgImage = title.HeaderSvgImage; |
| | | doc.ImageOptions.SvgImageSize = title.SvgImageSize; |
| | | var page = doc.Control as DocumentPage; |
| | | var page = doc.Controls[0] as DocumentPage; |
| | | if (page != null) |
| | | { |
| | | page.PageTitle = title; |
| | |
| | | |
| | | case eMoudingType.Tab: |
| | | { |
| | | this.tabbedView1.BeginUpdate(); |
| | | var doc = this.tabbedView1.AddDocument(page); |
| | | doc.Footer = Directory.GetCurrentDirectory(); |
| | | var sel_page = new XtraTabPage(); |
| | | page.Dock = DockStyle.Fill; |
| | | sel_page.Controls.Add(page); |
| | | this.xtraTabContrl.TabPages.Add(sel_page); |
| | | if (page.PageTitle != null) |
| | | { |
| | | doc.Caption = page.PageTitle.Caption; |
| | | doc.ImageOptions.Image = page.PageTitle.HeaderImage; |
| | | doc.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage; |
| | | doc.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize; |
| | | doc.Properties.AllowClose = page.PageTitle.AllowClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False; |
| | | sel_page.Text = page.PageTitle.Caption; |
| | | sel_page.ImageOptions.Image = page.PageTitle.HeaderImage; |
| | | sel_page.ImageOptions.SvgImage = page.PageTitle.HeaderSvgImage; |
| | | sel_page.ImageOptions.SvgImageSize = page.PageTitle.SvgImageSize; |
| | | //doc.Properties.AllowClose = page.PageTitle.AllowClose ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False; |
| | | } |
| | | doc.Tag = pguid; |
| | | this.tabbedView1.EndUpdate(); |
| | | this.tabbedView1.Controller.Activate(doc); |
| | | sel_page.Tag = pguid; |
| | | this.xtraTabContrl.SelectedTabPage = sel_page; |
| | | } |
| | | break; |
| | | |
| | |
| | | |
| | | case eMoudingType.Tab: |
| | | { |
| | | if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) |
| | | if (this.xtraTabContrl.TabPages != null && this.xtraTabContrl.TabPages.Count > 0) |
| | | { |
| | | var doc = this.tabbedView1.Documents.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | var doc = this.xtraTabContrl.TabPages.ToList().Find(x => x.Tag != null && x.Tag is PageGuid && (x.Tag as PageGuid).ToString() == pguid.ToString()); |
| | | if (doc != null) |
| | | { |
| | | this.tabbedView1.Controller.Close(doc);//会触发正在关闭和关闭事件 |
| | | this.xtraTabContrl.TabPages.Remove(doc); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | #region Modular |
| | | |
| | | private string _sel_modular = string.Empty; |
| | | |
| | | //选择模块 |
| | | private void SelectModular(string modular, PageGuid pageGuid = null) |
| | | private void SelectModular(string modular, PageGuid pguid = null) |
| | | { |
| | | //foreach (NavButton item in this.tileNavPane.Buttons) |
| | | //{ |
| | | // if (item.Tag == null) |
| | | // continue; |
| | | // if (item.Tag is int) |
| | | // { |
| | | // if (((int)item.Tag) == (int)modular) |
| | | // { |
| | | // item.Appearance.BackColor = Color.FromArgb(255, 128, 0); |
| | | // } |
| | | // else |
| | | // { |
| | | // item.Appearance.BackColor = Color.Transparent; |
| | | // } |
| | | // } |
| | | //} |
| | | //this.docPnlFuncList.Text = modular.ToString(); |
| | | //this.funcTreeListCtrl1.SetMatching(modular, surfaceGuid); |
| | | //if (surfaceGuid == null) |
| | | //{ |
| | | // var func = this.funcTreeListCtrl1.SetDefault(); |
| | | // if (func != null) |
| | | // CreateFuncPage(func); |
| | | //} |
| | | if (_sel_modular != modular) |
| | | { |
| | | foreach (NavButton btn in this.tileNavPane.Buttons) |
| | | { |
| | | if (btn.Tag == null) |
| | | continue; |
| | | if (btn.Tag is string tag) |
| | | { |
| | | if (tag == modular) |
| | | { |
| | | btn.Appearance.BackColor = Color.FromArgb(50, 121, 197); |
| | | btn.Appearance.ForeColor = Color.White; |
| | | } |
| | | else |
| | | { |
| | | btn.Appearance.BackColor = Color.White; |
| | | btn.Appearance.ForeColor = Color.Black; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //初始功能列表 |
| | | this.accordionControlFunction.Elements.Clear(); |
| | | var list = GetAccordionElementList(modular); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | foreach (var element in list) |
| | | { |
| | | var accEle = GetAccordionControlElement(element); |
| | | this.accordionControlFunction.Elements.Add(accEle); |
| | | } |
| | | } |
| | | _sel_modular = modular; |
| | | } |
| | | |
| | | //选择功能 |
| | | if (pguid != null) |
| | | { |
| | | foreach (var item in this.accordionControlFunction.Elements) |
| | | { |
| | | if (SelectAccordionControlElement(item, pguid)) |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取模块元素 |
| | | private DevExpress.XtraBars.Navigation.AccordionControlElement GetAccordionControlElement(AccordionElement ele) |
| | | { |
| | | var dev_ele = new DevExpress.XtraBars.Navigation.AccordionControlElement(); |
| | | dev_ele.Name = ele.Id; |
| | | dev_ele.Text = ele.Caption; |
| | | dev_ele.Image = ele.Image; |
| | | dev_ele.ImageOptions.SvgImage = ele.SvgImage; |
| | | dev_ele.ImageOptions.SvgImageSize = ele.SvgImageSize; |
| | | dev_ele.AllowGlyphSkinning = ele.AllowGlyphSkinning ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False; |
| | | dev_ele.Tag = ele; |
| | | dev_ele.Style = DevExpress.XtraBars.Navigation.ElementStyle.Item; |
| | | dev_ele.Click += delegate { ele.Click?.Invoke(); }; |
| | | if (ele.Elements != null && ele.Elements.Count > 0) |
| | | { |
| | | dev_ele.Style = DevExpress.XtraBars.Navigation.ElementStyle.Group; |
| | | foreach (var item in ele.Elements) |
| | | { |
| | | dev_ele.Elements.Add(GetAccordionControlElement(item)); |
| | | } |
| | | } |
| | | return dev_ele; |
| | | } |
| | | |
| | | //选择功能元素 |
| | | private bool SelectAccordionControlElement(DevExpress.XtraBars.Navigation.AccordionControlElement ctrl_ele, PageGuid pguid) |
| | | { |
| | | if (ctrl_ele == null) |
| | | return false; |
| | | if (pguid == null) |
| | | return false; |
| | | if (ctrl_ele.Tag is AccordionElement ele) |
| | | { |
| | | if (ele.PageGuid != null && ele.PageGuid.ToString() == pguid.ToString()) |
| | | { |
| | | this.accordionControlFunction.SelectedElement = ctrl_ele; |
| | | if (ctrl_ele.OwnerElement != null) |
| | | { |
| | | ctrl_ele.OwnerElement.Expanded = true; |
| | | this.accordionControlFunction.Refresh(); |
| | | } |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | if (ctrl_ele.Elements != null && ctrl_ele.Elements.Count > 0) |
| | | { |
| | | foreach (var item in ctrl_ele.Elements) |
| | | { |
| | | SelectAccordionControlElement(item, pguid); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | //获取 |
| | | private List<AccordionElement> GetAccordionElementList(string modular) |
| | | { |
| | | var list = new List<AccordionElement>(); |
| | | if (modular == "BasicData") |
| | | { |
| | | var place_mgr_ele = new AccordionElement() |
| | | { |
| | | Id = "place", |
| | | Caption = "场所管理", |
| | | SvgImage = svgImgGroup32[0], |
| | | SvgImageSize = new Size(24, 24), |
| | | AllowGlyphSkinning = true, |
| | | Elements = new List<AccordionElement>() |
| | | { |
| | | Get("行政区域",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "DistrictMgr", |
| | | }, svgImgItem32[0], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new DocumentPage(); |
| | | page.PageGuid = guid; |
| | | page.PageTitle.Caption = caption; |
| | | page.PageTitle.HeaderSvgImage = svg; |
| | | page.PageTitle.SvgImageSize = size; |
| | | CreatePage(page, guid); |
| | | } |
| | | }), |
| | | Get("场所建筑",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "PlaceMgr", |
| | | }, svgImgItem32[1], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new DocumentPage(); |
| | | page.PageGuid = guid; |
| | | page.PageTitle.Caption = caption; |
| | | page.PageTitle.HeaderSvgImage = svg; |
| | | page.PageTitle.SvgImageSize = size; |
| | | CreatePage(page, guid); |
| | | } |
| | | }), |
| | | Get("场所设施", new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "FacilityMgr", |
| | | }, svgImgItem32[2], new Size(18, 18), (caption, guid, svg, size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new DocumentPage(); |
| | | page.PageGuid = guid; |
| | | page.PageTitle.Caption = caption; |
| | | page.PageTitle.HeaderSvgImage = svg; |
| | | page.PageTitle.SvgImageSize = size; |
| | | CreatePage(page, guid); |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | var we_mgr_ele = new AccordionElement() |
| | | { |
| | | Id = "we", |
| | | Caption = "当量管理", |
| | | SvgImage = svgImgGroup32[1], |
| | | SvgImageSize = new Size(24, 24), |
| | | AllowGlyphSkinning = true, |
| | | Elements = new List<AccordionElement>() { |
| | | Get("用水器具",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "WaterUtensilMgr", |
| | | }, svgImgItem32[4], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("用水当量",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "WaterWEMgr", |
| | | }, svgImgItem32[5], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | var asset_mgr_ele = new AccordionElement() |
| | | { |
| | | Id = "asset", |
| | | Caption = "产品管理", |
| | | SvgImage = svgImgGroup32[2], |
| | | SvgImageSize = new Size(24, 24), |
| | | AllowGlyphSkinning = true, |
| | | Elements = new List<AccordionElement>() { |
| | | Get("厂商管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "AssetsManufacturerMgr", |
| | | }, svgImgItem32[6], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new DocumentPage(); |
| | | page.PageGuid = guid; |
| | | page.PageTitle.Caption = caption; |
| | | page.PageTitle.HeaderSvgImage = svg; |
| | | page.PageTitle.SvgImageSize = size; |
| | | CreatePage(page, guid); |
| | | } |
| | | }), |
| | | Get("水泵管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "AssetsPumpMgr", |
| | | }, svgImgItem32[7], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page=new PumpProductMainPage(); |
| | | page.PageGuid = guid; |
| | | page.PageTitle.Caption = caption; |
| | | page.PageTitle.HeaderSvgImage = svg; |
| | | page.PageTitle.SvgImageSize = size; |
| | | CreatePage(page,guid); |
| | | } |
| | | }), |
| | | Get("成套设备",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "AssetsKitMgr", |
| | | }, svgImgItem32[8], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | |
| | | var system_config_ele = new AccordionElement() |
| | | { |
| | | Id = "asset", |
| | | Caption = "系统配置", |
| | | SvgImage = svgImgGroup32[3], |
| | | SvgImageSize = new Size(24, 24), |
| | | AllowGlyphSkinning = true, |
| | | Elements = new List<AccordionElement>() { |
| | | Get("类型管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "SystemTypeMgr", |
| | | }, svgImgItem32[9], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("分类管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "SystemCatalogMgr", |
| | | }, svgImgItem32[10], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("属性管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "SystemPropMgr", |
| | | }, svgImgItem32[11], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("字典类型",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "SystemDictMgr", |
| | | }, svgImgItem32[12], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | } |
| | | }; |
| | | |
| | | var auth_config_ele = new AccordionElement() |
| | | { |
| | | Id = "asset", |
| | | Caption = "权限配置", |
| | | SvgImage = svgImgGroup32[4], |
| | | SvgImageSize = new Size(24, 24), |
| | | AllowGlyphSkinning = true, |
| | | Elements = new List<AccordionElement>() { |
| | | Get("角色管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "RoleMgr", |
| | | }, svgImgItem32[13], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("用户管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "UserMgr", |
| | | }, svgImgItem32[14], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | Get("菜单管理",new PageGuid() |
| | | { |
| | | Modular = "BasicData", |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = "MenuMgr", |
| | | }, svgImgItem32[15], new Size(18, 18), (caption,guid,svg,size) => |
| | | { |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | } |
| | | }), |
| | | } |
| | | }; |
| | | |
| | | list.Add(place_mgr_ele); |
| | | list.Add(we_mgr_ele); |
| | | list.Add(asset_mgr_ele); |
| | | list.Add(system_config_ele); |
| | | list.Add(auth_config_ele); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private AccordionElement Get(string caption, PageGuid guid, SvgImage svg_img, Size size, Action<string, PageGuid, SvgImage, Size> action, bool glyph_skinning = true) |
| | | { |
| | | var ele = new AccordionElement(); |
| | | if (guid == null) |
| | | { |
| | | ele.Id = Guid.NewGuid().ToString(); |
| | | } |
| | | else |
| | | { |
| | | ele.Id = guid.ToString(); |
| | | ele.Click = delegate { action(caption, guid, svg_img, size); }; |
| | | } |
| | | ele.PageGuid = guid; |
| | | ele.Caption = caption; |
| | | ele.SvgImage = svg_img; |
| | | ele.SvgImageSize = size; |
| | | ele.AllowGlyphSkinning = glyph_skinning; |
| | | return ele; |
| | | } |
| | | |
| | | #endregion Modular |
| | | |
| | | //上一页 |
| | | private void navBtnPrevious_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | this.tabbedView1.Controller.SelectNextTab(false); |
| | | } |
| | | |
| | | //下一页 |
| | | private void navBtnNext_ElementClick(object sender, NavElementEventArgs e) |
| | | { |
| | | this.tabbedView1.Controller.SelectNextTab(true); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |