public string InvokeGetContent(IRibbonControl control, Expression<Action> caller, params object[] parameters) { // Remove any previous registered callbacks for this dynamic context vstoContribContext.RemoveCallbacksForDynamicContext(control.Tag); // Delegate to the view model to get the raw xml var xmlString = InvokeGet(control, caller, parameters); if (xmlString == null) return null; // Rewrite the XML with our callbacks, registering new callback targets var ribbonXmlRewriter = new RibbonXmlRewriter(vstoContribContext, ribbonViewModelResolver); var ribbonType = vstoContribContext.TagToCallbackTargetLookup[control.Tag + caller.GetMethodName()].RibbonType; return ribbonXmlRewriter.RewriteDynamicXml(ribbonType, control.Tag, xmlString.ToString()); }
public string InvokeGetContent(IRibbonControl control, Expression <Action> caller, params object[] parameters) { // Remove any previous registered callbacks for this dynamic context vstoContribContext.RemoveCallbacksForDynamicContext(control.Tag); // Delegate to the view model to get the raw xml var xmlString = InvokeGet(control, caller, parameters); if (xmlString == null) { return(null); } // Rewrite the XML with our callbacks, registering new callback targets var ribbonXmlRewriter = new RibbonXmlRewriter(vstoContribContext, ribbonViewModelResolver); var ribbonType = vstoContribContext.TagToCallbackTargetLookup[control.Tag + caller.GetMethodName()].RibbonType; return(ribbonXmlRewriter.RewriteDynamicXml(ribbonType, control.Tag, xmlString.ToString())); }
public RibbonFactoryController( IViewContextProvider viewContextProvider, VstoContribContext vstoContribContext) { this.vstoContribContext = vstoContribContext; var ribbonTypes = GetTRibbonTypesInAssemblies(vstoContribContext.Assemblies).ToList(); customTaskPaneRegister = new CustomTaskPaneRegister(vstoContribContext.AddinBase); ribbonViewModelResolver = new ViewModelResolver( ribbonTypes, customTaskPaneRegister, viewContextProvider, vstoContribContext); var ribbonXmlRewriter = new RibbonXmlRewriter(vstoContribContext, ribbonViewModelResolver); var loadExpression = ((Expression <Action <RibbonFactory> >)(r => r.Ribbon_Load(null))); string loadMethodName = loadExpression.GetMethodName(); foreach (Type viewModelType in ribbonTypes) { ribbonXmlRewriter.LocateAndRegisterViewXml(viewModelType, loadMethodName, vstoContribContext.FallbackRibbonType); } }
public RibbonFactoryController( IViewContextProvider viewContextProvider, VstoContribContext vstoContribContext) { this.vstoContribContext = vstoContribContext; var ribbonTypes = GetTRibbonTypesInAssemblies(vstoContribContext.Assemblies).ToList(); customTaskPaneRegister = new CustomTaskPaneRegister(vstoContribContext.AddinBase); ribbonViewModelResolver = new ViewModelResolver( ribbonTypes, customTaskPaneRegister, viewContextProvider, vstoContribContext); var ribbonXmlRewriter = new RibbonXmlRewriter(vstoContribContext, ribbonViewModelResolver); var loadExpression = ((Expression<Action<RibbonFactory>>)(r => r.Ribbon_Load(null))); string loadMethodName = loadExpression.GetMethodName(); foreach (Type viewModelType in ribbonTypes) { ribbonXmlRewriter.LocateAndRegisterViewXml(viewModelType, loadMethodName, vstoContribContext.FallbackRibbonType); } }