Пример #1
0
        /// <summary>
        /// Create and return a new store
        /// </summary>
        /// <remarks>
        /// Override the default behaviour to put the doc data's composition container into the store's property bag.
        /// By default, the runtime will add the CompositionService from the DslShell ModelingCompositionContainer
        /// if the property has not already been set.
        /// </remarks>
        protected override DslModeling::Store CreateStore()
        {
            DslModeling::Store store = base.CreateStore();

            global::System.ComponentModel.Composition.ICompositionService compositionService = this.CompositionService;
            // Add the composition container to the property bag even if it is null. This will prevent the runtime from
            // adding the shared ModelingCompositionContainer.CompositionService.
            store.PropertyBag.Add(DslModeling::ExtensionEnablement.ExtensionEnablementConstants.ContainerId, compositionService);

            return(store);
        }
 /// <summary>
 /// Initialize Extension Registrars.
 /// </summary>
 partial void InitializeExtensions()
 {
     global::System.ComponentModel.Composition.ICompositionService compositionService = global::Microsoft.VisualStudio.Modeling.Shell.ModelingCompositionContainer.CompositionService;
     if (compositionService != null)
     {
         if (this.CommandExtensionRegistrar != null)
         {
             compositionService.SatisfyImportsOnce(global::System.ComponentModel.Composition.AttributedModelServices.CreatePart(this.CommandExtensionRegistrar));
             this.CommandExtensionRegistrar.Initialize(this);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Satisfy Imports in DocData object
 /// </summary>
 protected virtual void InitializeComposition()
 {
     global::System.ComponentModel.Composition.ICompositionService compositionService = this.CompositionService;
     if (compositionService != null)
     {
         try
         {
             compositionService.SatisfyImportsOnce(global::System.ComponentModel.Composition.AttributedModelServices.CreatePart(this));
         }
         catch (global::System.Exception ex)
         {
             // Handle binding failures
             if (!HandleBindingFailure(ex))
             {
                 throw;
             }
         }
     }
 }