Beispiel #1
0
 internal static Microsoft.Practices.ComponentModel.ServiceContainer CreateFilter(IServiceProvider provider, string filterTypeName, StringDictionary attributes, out ICodeModelEditorFilter filter)
 {
     Microsoft.Practices.ComponentModel.ServiceContainer editorServiceProvider = new Microsoft.Practices.ComponentModel.ServiceContainer(true);
     editorServiceProvider.Site = new Site(provider, editorServiceProvider, editorServiceProvider.GetType().FullName);
     editorServiceProvider.AddService(typeof(IDictionaryService), new DictionaryWrapper(attributes));
     if (string.IsNullOrEmpty(filterTypeName))
     {
         filter = null;
     }
     else
     {
         ITypeResolutionService typeResService =
             (ITypeResolutionService)provider.GetService(typeof(ITypeResolutionService));
         Type filterType = typeResService.GetType(filterTypeName);
         if (filterType == null)
         {
             filter = null;
         }
         else
         {
             filter = (ICodeModelEditorFilter)Activator.CreateInstance(filterType);
             if (filter is IComponent)
             {
                 editorServiceProvider.Add((IComponent)filter);
             }
         }
     }
     return(editorServiceProvider);
 }
Beispiel #2
0
 internal Microsoft.Practices.ComponentModel.ServiceContainer CreateEditorServiceProvider(IServiceProvider provider, out ISolutionPickerFilter filter)
 {
     Microsoft.Practices.ComponentModel.ServiceContainer editorServiceProvider = new Microsoft.Practices.ComponentModel.ServiceContainer(true);
     editorServiceProvider.Site = new Site(provider, editorServiceProvider, editorServiceProvider.GetType().FullName);
     editorServiceProvider.AddService(typeof(IDictionaryService), new DictionaryWrapper(attributes));
     filter = CreateEditorFilter(provider);
     if (filter is IComponent)
     {
         editorServiceProvider.Add((IComponent)filter);
     }
     return(editorServiceProvider);
 }
Beispiel #3
0
 public AssetMenuCommand(GuidancePackage guidancePackage,
                         Microsoft.Practices.ComponentModel.ServiceContainer serviceProvider, CommandID commandId)
     : base(null, commandId)
 {
     if (serviceProvider == null || guidancePackage == null || commandId == null)
     {
         throw new ArgumentNullException("RecipeMenuCommand");
     }
     this.serviceProvider    = serviceProvider;
     this.guidancePackage    = guidancePackage;
     this.Supported          = true;
     this.Visible            = true;
     this.Enabled            = true;
     this.BeforeQueryStatus += new EventHandler(OnBeforeQueryStatus);
 }
        public void SetUp()
        {
            sc = new CM.ServiceContainer();

            // Add TypeResolutionService
            TypeResolutionService typeResolutionService = new TypeResolutionService(
                AppDomain.CurrentDomain.BaseDirectory);

            sc.AddService(typeof(ITypeResolutionService), typeResolutionService);
            sc.AddService(typeof(IConfigurationService), new MockConfigurationService(AppDomain.CurrentDomain.BaseDirectory));

            // Add ValueInfoService
            IValueInfoService valueInfoService = new MockValueInfoService();

            sc.AddService(typeof(IValueInfoService), valueInfoService);
        }
Beispiel #5
0
        public void SetUp()
        {
            sc = new CM.ServiceContainer();

            EnvDTE.DTE dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.14.0");
            ITextTemplatingEngineHost syshost;

            syshost = new ServiceProvider(dte as Microsoft.VisualStudio.OLE.Interop.IServiceProvider).GetService(typeof(STextTemplating)) as ITextTemplatingEngineHost;

            // Add TypeResolutionService
            TypeResolutionService typeResolutionService = new TypeResolutionService(
                AppDomain.CurrentDomain.BaseDirectory);

            sc.AddService(typeof(ITypeResolutionService), typeResolutionService);
            sc.AddService(typeof(IConfigurationService), new MockConfigurationService(AppDomain.CurrentDomain.BaseDirectory));
            sc.AddService(typeof(STextTemplating), syshost);

            // Add ValueInfoService
            IValueInfoService valueInfoService = new MockValueInfoService();

            sc.AddService(typeof(IValueInfoService), valueInfoService);
        }
        public void SetUp()
        {
            recipeConfiguration      = new Microsoft.Practices.RecipeFramework.Configuration.Recipe();
            recipeConfiguration.Name = "Test";

            Configuration.Action first = new Configuration.Action();
            first.Name = "First";
            first.Type = typeof(FirstAction).FullName;

            Configuration.Action second = new Configuration.Action();
            second.Name = "Second";
            second.Type = typeof(SecondAction).FullName;

            recipeConfiguration.Actions        = new Configuration.RecipeActions();
            recipeConfiguration.Actions.Action = new Configuration.Action[] { first, second };

            container = new Microsoft.Practices.ComponentModel.ServiceContainer();
            container.AddService(typeof(System.ComponentModel.Design.ITypeResolutionService), new MockResolutionService());
            container.AddService(typeof(System.ComponentModel.Design.IDictionaryService), new MockDictionary());
            container.AddService(typeof(Microsoft.Practices.RecipeFramework.Services.IConfigurationService),
                                 new MockConfigrationService());
            container.AddService(typeof(IComponentChangeService), new MockChangeService());
            container.AddService(typeof(IValueInfoService), new MockValueInfoService());
        }
		internal Microsoft.Practices.ComponentModel.ServiceContainer CreateEditorServiceProvider(IServiceProvider provider, out ISolutionPickerFilter filter)
		{
			Microsoft.Practices.ComponentModel.ServiceContainer editorServiceProvider = new Microsoft.Practices.ComponentModel.ServiceContainer(true);
			editorServiceProvider.Site = new Site(provider, editorServiceProvider, editorServiceProvider.GetType().FullName);
			editorServiceProvider.AddService(typeof(IDictionaryService), new DictionaryWrapper(attributes));
			filter = CreateEditorFilter(provider);
			if(filter is IComponent)
			{
				editorServiceProvider.Add((IComponent)filter);
			}
			return editorServiceProvider;
		}