Beispiel #1
0
        private void CheckReferences()
        {
            SolutionPackagesContainer container = (SolutionPackagesContainer)GetService(typeof(IHostService));
            IPersistenceService       persist   = (IPersistenceService)container.GetService(typeof(IPersistenceService), true);

            foreach (object obj in container.Components)
            {
                if (obj is VsGuidancePackage)
                {
                    GuidancePackage package = ((VsGuidancePackage)obj).GuidancePackage;

                    if ((package == null) || (package.Configuration == null))
                    {
                        continue;
                    }

                    foreach (IAssetReference reference in persist.LoadReferences(package.Configuration.Name))
                    {
                        if (reference is IBoundAssetReference)
                        {
                            IBoundAssetReference boundReference = (IBoundAssetReference)reference;
                            if (boundReference.Target == null)
                            {
                                referencesToFix.Add(
                                    new FixupReference(package, reference.AssetName, boundReference));
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private object OnCreateService(IServiceContainer container, Type serviceType)
        {
            object newService = null;

            if (serviceType == typeof(IRecipeManagerService))
            {
                newService = new RecipeManager();
            }
            else if (serviceType == typeof(IHostService))
            {
                newService = new SolutionPackagesContainer();
            }
            else if (serviceType == typeof(IPersistenceService))
            {
                // REVIEW (v-vaprea): this assumes the type implementing IHostService will always
                // implements IPersistenceService, not really nice...
                return(GetService(typeof(IHostService)));
            }
            else if (serviceType == typeof(IVsTemplatesService))
            {
                newService = new VSTemplatesService();
            }
            else if (serviceType == typeof(IVsFilterAddProjectItemDlg))
            {
                newService = (IVsFilterAddProjectItemDlg)(new Templates.TemplateFilter());
            }
            // Now, let's site the new service
            if (newService != null && newService is IComponent)
            {
                // Site it so VS acts as the container.
                ((IComponent)newService).Site =
                    new Site(this as System.IServiceProvider, newService as IComponent, newService.GetType().Name);
                ServiceHelper.CheckDependencies((IComponent)newService);
            }
            return(newService);
        }