void navigationItemCreated(object sender, NavigationItemCreatedEventArgs e)
        {
            ChoiceActionItem navigationItem = e.NavigationItem;
            IModelObjectView viewNode       = ((IModelNavigationItem)e.NavigationItem.Model).View as IModelObjectView;

            if (viewNode != null)
            {
                ITypeInfo objectTypeInfo = XafTypesInfo.Instance.FindTypeInfo(viewNode.ModelClass.Name);
                if (objectTypeInfo != null)
                {
                    CriteriaOperator     docCriteria   = CriteriaOperator.Parse("ObjectType == ?", objectTypeInfo.Type);
                    IObjectSpace         myObjectSpace = Application.CreateObjectSpace(typeof(HelpDocument));
                    IList <HelpDocument> docs          = myObjectSpace.GetObjects <HelpDocument>(docCriteria);
                    if (docs.Count > 0)
                    {
                        ChoiceActionItem docsGroup = new ChoiceActionItem("CustomDocuments", "Task-Based Help", null)
                        {
                            ImageName = "BO_Report"
                        };
                        navigationItem.Items.Add(docsGroup);
                        foreach (HelpDocument doc in docs)
                        {
                            ViewShortcut     shortcut = new ViewShortcut(typeof(HelpDocument), doc.Oid.ToString(), "HelpDocument_DetailView_FewColumns");
                            ChoiceActionItem docItem  = new ChoiceActionItem(doc.Oid.ToString(), doc.Title, shortcut)
                            {
                                ImageName = "Navigation_Item_Report"
                            };
                            docsGroup.Items.Add(docItem);
                        }
                    }
                }
            }
        }
 void navigationController_NavigationItemCreated(object sender, NavigationItemCreatedEventArgs e)
 {
     if (e.NavigationItem.Id == "MyDetails")
     {
         ViewShortcut shortcut = e.NavigationItem.Data as ViewShortcut;
         if (shortcut != null)
         {
             shortcut["ObjectKey"] = SecuritySystem.CurrentUserId.ToString();
         }
     }
 }
        private void NavigationController_NavigationItemCreated(object sender, NavigationItemCreatedEventArgs e)
        {
            ChoiceActionItem navigationItem = e.NavigationItem;

            if (navigationItem.Items != null && navigationItem.Items.Count > 0)
            {
                foreach (ChoiceActionItem item in navigationItem.Items)
                {
                    IModelObjectView viewNode = ((IModelNavigationItem)item.Model).View as IModelObjectView;
                    if (viewNode != null)
                    {
                        ITypeInfo objectTypeInfo = XafTypesInfo.Instance.FindTypeInfo(viewNode.ModelClass.Name);
                        var       attr           = objectTypeInfo.FindAttribute <NavigationItemCaptionAttribute>();
                        if (attr != null)
                        {
                            navigationItem.Caption = attr.Caption;
                            break;
                        }
                    }
                }
            }
        }
Beispiel #4
0
        void navigationItemCreated(object sender, NavigationItemCreatedEventArgs e)
        {
            ChoiceActionItem navigationItem = e.NavigationItem;

            CreateDynamicMenu(navigationItem);
        }