protected override void InitController() { base.InitController(); //init page group InitPageGroup(); //format string formatOperatePageGroup = "FormatOperatePageGroup"; RegisterCommandInvoker("Format", "Format", null, formatOperatePageGroup, false, 84); //related RegisterRelatedEntityCommand(); // init convert InitConvert(); //flter var fastOperateGroup = UIExtensionSites["HomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Filters"))); string fastOperatePageGroup = "FastOperatePageGroup"; UIExtensionSites.RegisterSite(fastOperatePageGroup, fastOperateGroup); RibbonGalleryBar ribbonGallery = new RibbonGalleryBar(this, _entityListView, EntityName); UIExtensionSites[fastOperatePageGroup].Add(ribbonGallery); ribbonGallery.InitFilters(); InitLoginUser(fastOperateGroup.Ribbon); }
private void RegisterRelatedEntityCommand() { var allRelationshipRoles = MetadataProvider.Instance.EntityRelationshipRoles; var relationshipRoles = allRelationshipRoles.Where( role => role.Entity.PhysicalName == EntityName && role.NavPanelDisplayOption == 1); if (relationshipRoles.Any()) { var relatedEntityButtons = new List <BarButtonItemEx>(); foreach (var relationshipRole in relationshipRoles) { var entityRelation = relationshipRole.EntityRelationship; var relatedRole = entityRelation.EntityRelationshipRoles .FirstOrDefault(r => r != relationshipRole && r.RelationshipRoleType == (int)RelationshipRoleType.ManyToOne); if (relatedRole == null) { continue; } var name = relatedRole.Entity.PhysicalName; if (!AuthorizationManager.CheckAccess(name, "Read")) { continue; } var relationship = entityRelation.EntityRelationshipRelationships.First().Relationship; var localizedCaption = Properties.Resources.ResourceManager.GetString(name); var buttonItem = new BarButtonItemEx(name, "Search") { Caption = localizedCaption }; buttonItem.ItemClick += (s, e) => { ShowRelatedEntityList(relationship, name); }; buttonItem.Name = name; if (relationshipRoles.Count() > 1) { buttonItem.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText; } buttonItem.ButtonStyle = BarButtonStyle.Check; relatedEntityButtons.Add(buttonItem); } if (relatedEntityButtons.Any()) { var generalGroup = UIExtensionSites["DetailHomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Related"))); UIExtensionSites.RegisterSite("DetailRelatedGroup", generalGroup); foreach (var button in relatedEntityButtons) { UIExtensionSites["DetailRelatedGroup"].Add(button); } } } }
private void AddMenuItems() { if (queueItem == null) { queueItem = new ToolStripMenuItem("Queue"); UIExtensionSites[UIExtensionConstants.FILE].Add(queueItem); UIExtensionSites.RegisterSite(UIExtensionConstants.QUEUE, queueItem.DropDownItems); ToolStripMenuItem acceptCustomer = new ToolStripMenuItem("Accept Customer"); acceptCustomer.ShortcutKeys = Keys.Control | Keys.A; UIExtensionSites[UIExtensionConstants.QUEUE].Add(acceptCustomer); Commands[CommandConstants.ACCEPT_CUSTOMER].AddInvoker(acceptCustomer, "Click"); } }
private void InitPageGroup() { var showGroup = UIExtensionSites["HomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Show"))); string showPageGroup = "ShowPageGroup"; UIExtensionSites.RegisterSite(showPageGroup, showGroup); var addGroup = UIExtensionSites["HomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Add"))); string addPageGroup = "AddPageGroup"; UIExtensionSites.RegisterSite(addPageGroup, addGroup); var foramtOperateGroup = UIExtensionSites["SkinPage"].Add(new RibbonPageGroup(GetLocalizedCaption("Format"))); string formatOperatePageGroup = "FormatOperatePageGroup"; UIExtensionSites.RegisterSite(formatOperatePageGroup, foramtOperateGroup); }
private void AddMenuItems() { if (queueItem == null) { queueItem = new MenuItem(); queueItem.Header = "Queue"; queueItem.Tag = 5; UIExtensionSites[UIExtensionConstants.FILE].Add(queueItem); UIExtensionSites.RegisterSite(UIExtensionConstants.QUEUE, queueItem); MenuItem acceptCustomer = new MenuItem(); acceptCustomer.Header = "Accept Customer"; // acceptCustomer.ShortcutKeys = Keys.Control | Keys.A; UIExtensionSites[UIExtensionConstants.QUEUE].Add(acceptCustomer); Commands[CommandConstants.ACCEPT_CUSTOMER].AddInvoker(acceptCustomer, "Click"); } }
private void AddShowNavBarGroups() { _moduleGroups.Add("Sales", new List <string>(new[] { "Lead", "Opportunity", "Quote", "Contract", "Invoice", "Account", "Contact" })); _moduleGroups.Add("ProjectManagement", new List <string>(new[] { "Project", "ProjectTask", "ProjectWeekReport", "Attendance" })); _moduleGroups.Add("Reports", new List <string>(new[] { "OpportunityReport", "ProjectReport" })); _moduleGroups.Add("Services", new List <string>(new[] { "Product", "Task" })); _moduleGroups.Add("Administration", new List <string>(new[] { "User", "Role" })); foreach (var moduleGroup in _moduleGroups) { var group = new NavBarGroup(GetLocalizedCaption(moduleGroup.Key)); foreach (var module in moduleGroup.Value) { if (!AuthorizationManager.CheckAccess(module, "Read")) { continue; } var localizedCaption = GetLocalizedCaption(module); var item = new NavBarItem(localizedCaption); string moduleName = module; item.LinkClicked += (s, e) => ShowEntityList(moduleName); item.Name = module; item.LargeImage = GetBitmapByName(module, new Size(32, 32)); item.SmallImage = GetBitmapByName(module, new Size(32, 32)); group.ItemLinks.Add(item); } if (group.ItemLinks.Count == 0) { continue; } group.LargeImage = GetBitmapByName(moduleGroup.Key, new Size(32, 32)); group.SmallImage = GetBitmapByName(moduleGroup.Key, new Size(32, 32)); UIExtensionSites[ExtensionSiteNames.ShellNavBar].Add(group); UIExtensionSites.RegisterSite(moduleGroup.Key, group); } }
public virtual void Initialize() { _userDataPersistenceService = new UserDataPersistenceService(EntityName + "Detail"); Services.Add(_userDataPersistenceService); _detailLayoutView = Items.AddNew <DetailLayoutView>(); _detailLayoutView.EntityName = EntityName; var homePage = UIExtensionSites[ExtensionSiteNames.DetailRibbon].Add(new RibbonPage(GetLocalizedCaption("Home"))); UIExtensionSites.RegisterSite("DetailHomePage", homePage); var generalGroup = UIExtensionSites["DetailHomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("General"))); UIExtensionSites.RegisterSite("DetailGeneralPageGroup", generalGroup); RegisterGenearlCommand("SaveAndClose", "Save", "Exit"); RegisterGenearlCommand("Save", "Save", null); RegisterGenearlCommand("DetailGeneralPageGroup", "EditMode", "Edit", null, "Edit"); }
private void InitConvert() { List <ColumnMapping> mappingList = MetadataProvider.Instance.MappingList .Where(c => c.SourceEntityName == EntityName).ToList(); var toConverList = mappingList.Select(c => c.TargetEntityName).Distinct(); if (toConverList.Any()) { var convertEntityButtons = new List <BarButtonItemEx>(); foreach (string commandName in toConverList) { if (!AuthorizationManager.CheckAccess(commandName, "Write")) { continue; } var localizedCaption = GetLocalizedCaption(commandName); var buttonItem = new BarButtonItemEx(commandName, "convert") { Caption = localizedCaption }; buttonItem.Name = commandName; if (toConverList.Count() > 1) { buttonItem.RibbonStyle = DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithText | DevExpress.XtraBars.Ribbon.RibbonItemStyles.SmallWithoutText; } buttonItem.ItemClick += (s, e) => { ShowRelatedEntityDetail(e.Item.Name, Guid.Empty, EntityDetailWorkingMode.Convert); }; convertEntityButtons.Add(buttonItem); } if (convertEntityButtons.Count > 0) { var convertGroup = UIExtensionSites["DetailHomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("ConvertTitle"))); UIExtensionSites.RegisterSite("DetailConvertGroup", convertGroup); foreach (var button in convertEntityButtons) { UIExtensionSites["DetailConvertGroup"].Add(button); } } } }
protected override void UpdateCommandStatus() { base.UpdateCommandStatus(); if (WorkingMode == EntityDetailWorkingMode.View) { Commands["CopyAndNew"].Status = CommandStatus.Unavailable; } else { Commands["CopyAndNew"].Status = !HasChanges && WorkingMode != EntityDetailWorkingMode.Add ? CommandStatus.Enabled : CommandStatus.Disabled; } bool status = WorkingMode != EntityDetailWorkingMode.Add ? true : false; var relatedSiteName = UIExtensionSites.Where(c => c.ToString() == "DetailRelatedGroup"); if (relatedSiteName.ToList().Count > 0) { var relatedItems = UIExtensionSites["DetailRelatedGroup"]; var buttons = relatedItems.OfType <BarButtonItemEx>(); foreach (var button in buttons) { button.Enabled = status; } } var convertSiteName = UIExtensionSites.Where(c => c.ToString() == "DetailConvertGroup"); if (convertSiteName.ToList().Count > 0) { var convertItems = UIExtensionSites["DetailConvertGroup"]; var buttons = convertItems.OfType <BarButtonItemEx>(); foreach (var button in buttons) { button.Enabled = status; } } }
private void AddMenuItems() { if (queueItem != null) { return; } const string acceptCustomerCaption = "Accept Customer"; var acceptCustomer = new BarButtonItem { Caption = acceptCustomerCaption, Hint = acceptCustomerCaption, Glyph = Resources.AcceptCustomer16, LargeGlyph = Resources.AcceptCustomer32, ItemShortcut = new BarShortcut(Keys.Control | Keys.A) }; string extensionSite; #if UseRibbonForm extensionSite = ExtensionSiteNames.File; // add also the the Quick Access Toolbar and to the ApplicationMenu UIExtensionSites[ExtensionSiteNames.RibbonQuickAccessToolbar].Add(acceptCustomer); UIExtensionSites[ExtensionSiteNames.RibbonApplicationMenu].Add(acceptCustomer); #else queueItem = new BarSubItem { Caption = "Queue" }; UIExtensionSites[ExtensionSiteNames.File].Add(queueItem); UIExtensionSites.RegisterSite(ExtensionSiteNames.Queue, queueItem); extensionSite = ExtensionSiteNames.Queue; UIExtensionSites[ExtensionSiteNames.ToolBar].Add(acceptCustomer); #endif UIExtensionSites[extensionSite].Add(acceptCustomer); Commands[CommandNames.AcceptCustomer].AddInvoker(acceptCustomer, "ItemClick"); }
protected virtual void UpdateCommandStatus() { Commands["Add"].Status = AuthorizationManager.CheckAccess(EntityName, "Create") ? CommandStatus.Enabled : CommandStatus.Unavailable; SetCommandStatus("Edit", "Write"); SetCommandStatus("View", "Read"); SetCommandStatus("Delete", "Delete"); if (!UIExtensionSites.Contains("RelatedGroup")) { return; } var relatedItems = UIExtensionSites["RelatedGroup"]; if (relatedItems != null) { var buttons = relatedItems.OfType <BarButtonItemEx>(); foreach (var button in buttons) { button.Enabled = _entityListView.SelectedEntity != null && _entityListView.EntityGridView.RowCount != 0; } } var convertSiteName = UIExtensionSites.Where(c => c.ToString() == "ConvertGroup"); if (convertSiteName.ToList().Count > 0) { var convertItems = UIExtensionSites["ConvertGroup"]; var buttons = convertItems.OfType <BarButtonItemEx>(); foreach (var button in buttons) { button.Enabled = _entityListView.SelectedEntity != null && _entityListView.EntityGridView.RowCount != 0; } } }
public override void Initialize() { base.Initialize(); var showGroup = UIExtensionSites["DetailHomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Show"))); UIExtensionSites.RegisterSite(ExtensionSiteNames.DetailShowRibbonPageGroup, showGroup); RegisterGenearlCommand("CopyAndNew", "Save", "Copy"); RegisterShowCommand("ShowGeneral", EntityName, null, "General"); var addGroup = UIExtensionSites["DetailHomePage"].Add(new RibbonPageGroup(GetLocalizedCaption("Add"))); UIExtensionSites.RegisterSite(ExtensionSiteNames.DetailAddGroup, addGroup); InitConvert(); RegisterRelatedEntityCommand(); Workspaces[WorkspaceNames.DetailContentWorkspace].SmartPartActivated += (sender, e) => { PropertyInfo property = e.SmartPart.GetType().GetProperty("EntityName"); if (property == null) { return; } if (property.GetValue(e.SmartPart, null) == null) { return; } string smartEntityName = property.GetValue(e.SmartPart, null).ToString(); if (smartEntityName == EntityName) { smartEntityName = "ShowGeneral"; } foreach (var site in UIExtensionSites["DetailHomePage"]) { RibbonPageGroup pageGroup = site as RibbonPageGroup; if (pageGroup == null) { continue; } foreach (var itemLink in pageGroup.ItemLinks) { BarButtonItemLink barItemLink = itemLink as BarButtonItemLink; if (barItemLink == null) { continue; } BarButtonItemEx itemEx = barItemLink.Item as BarButtonItemEx; if (itemEx == null && itemEx.ButtonStyle != BarButtonStyle.Check) { continue; } if (itemEx.Name.Contains(smartEntityName)) { itemEx.Down = true; } else { itemEx.Down = false; } } } }; }