示例#1
0
        private void BindMergeAction(PopupWindowShowAction pswAction)
        {
            IActionControlsSite     site      = Frame.Template as IActionControlsSite;
            IActionControlContainer container = GetTargetActionContainer(site, pswAction);

            if (container != null && container.FindActionControl(pswAction.Id) == null)
            {
                if (bAddAction)
                {
                    // Action noch nicht da
                    ISimpleActionControl actionControl = container.AddSimpleActionControl(pswAction.Id);
                    actionControl.NativeControlDisposed += ActionControl_NativeControlDisposed;
                    ActionBinding actionBinding = ActionBindingFactory.Instance.Create(pswAction, actionControl);
                    if (!dictBinding.ContainsKey(pswAction))
                    {
                        dictBinding.Add(pswAction, actionBinding);
                    }
                }
            }
            if (container != null && container.FindActionControl(pswAction.Id) == null)
            {
                if (bAddAction)
                {
                    if (!dictBinding.ContainsKey(pswAction))
                    {
                        ISimpleActionControl actionControl = container.AddSimpleActionControl(pswAction.Id);
                        actionControl.NativeControlDisposed += ActionControl_NativeControlDisposed;
                        ActionBinding actionBinding = ActionBindingFactory.Instance.Create(pswAction, actionControl);
                        dictBinding.Add(pswAction, actionBinding);
                    }
                }
            }
        }
示例#2
0
 private static void WinApplication_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e)
 {
     if (e.Context == TemplateContext.ApplicationWindow || e.Context == TemplateContext.View)
     {
         RibbonForm          ribbonForm         = e.Template as RibbonForm;
         IActionControlsSite actionControlsSite = ribbonForm as IActionControlsSite;
         if ((ribbonForm != null) && (actionControlsSite != null))
         {
             IActionControlContainer filtersActionControlContainer = actionControlsSite.ActionContainers.FirstOrDefault <IActionControlContainer>(x => x.ActionCategory == "Filters");
             if (filtersActionControlContainer is BarLinkActionControlContainer)
             {
                 BarLinkActionControlContainer barFiltersActionControlContainer = (BarLinkActionControlContainer)filtersActionControlContainer;
                 BarLinkContainerItem          barFiltersItem = barFiltersActionControlContainer.BarContainerItem;
                 RibbonControl ribbonControl = ribbonForm.Ribbon;
                 foreach (RibbonPage page in ribbonControl.Pages)
                 {
                     foreach (RibbonPageGroup group in page.Groups)
                     {
                         BarItemLink barFiltersItemLink = group.ItemLinks.FirstOrDefault <BarItemLink>(x => x.Item == barFiltersItem);
                         if (barFiltersItemLink != null)
                         {
                             group.ItemLinks.Remove(barFiltersItemLink);
                         }
                     }
                 }
                 ribbonForm.Ribbon.PageHeaderItemLinks.Add(barFiltersItem);
             }
         }
     }
     else if ((e.Context == TemplateContext.LookupControl) || (e.Context == TemplateContext.LookupWindow))
     {
         LookupControlTemplate lookupControlTemplate = e.Template as LookupControlTemplate;
         if (lookupControlTemplate == null && e.Template is LookupForm)
         {
             lookupControlTemplate = ((LookupForm)e.Template).FrameTemplate;
         }
         if (lookupControlTemplate != null)
         {
             lookupControlTemplate.ObjectsCreationContainer.ContainerId = "LookupNew";
             lookupControlTemplate.SearchActionContainer.ContainerId    = "LookupFullTextSearch";
         }
     }
 }