Esempio n. 1
0
        private IImageProvider GetImageProvider()
        {
            var solution = VisualStudioUtility.GetSolutionSettingsFileFullPath();
            var ret      = _imageProviders.FirstOrDefault(x => x.SolutionConfigFile == solution && x.ProviderType == _settings.ImageBackgroundType);

            if (!string.IsNullOrEmpty(solution))
            {
                ret = _imageProviders.FirstOrDefault(x => x.SolutionConfigFile == solution);
                if (ret == null)
                {
                    ret = _imageProviders.FirstOrDefault(x => x.SolutionConfigFile == null && x.ProviderType == _settings.ImageBackgroundType);
                }
            }
            else
            {
                ret = _imageProviders.FirstOrDefault(x => x.SolutionConfigFile == null && x.ProviderType == _settings.ImageBackgroundType);
            }

            if (ret == null)
            {
                ret = new SingleImageProvider(Setting.Instance);
            }

            return(ret);
        }
Esempio n. 2
0
        /// <summary>
        /// Instantiates a ClaudiaIDE manager when a textView is created.
        /// </summary>
        /// <param name="textView">The <see cref="IWpfTextView"/> upon which the adornment should be placed</param>
        public void TextViewCreated(IWpfTextView textView)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var settings = Setting.Initialize((EnvDTE.DTE)ServiceProvider.GetService(typeof(EnvDTE.DTE)));
            var solution = VisualStudioUtility.GetSolutionSettingsFileFullPath();

            if (ImageProviders == null)
            {
                if (ProvidersHolder.Instance.Providers == null)
                {
                    if (string.IsNullOrEmpty(solution))
                    {
                        ProvidersHolder.Initialize(settings, new List <IImageProvider>
                        {
                            new SingleImageEachProvider(settings),
                            new SlideShowImageProvider(settings),
                            new SingleImageProvider(settings)
                        });
                    }
                    else
                    {
                        ProvidersHolder.Initialize(settings, new List <IImageProvider>());
                        switch (settings.ImageBackgroundType)
                        {
                        case ImageBackgroundType.Single:
                            ProvidersHolder.Instance.Providers.Add(new SingleImageProvider(settings, solution));
                            break;

                        case ImageBackgroundType.SingleEach:
                            ProvidersHolder.Instance.Providers.Add(new SingleImageEachProvider(settings, solution));
                            break;

                        case ImageBackgroundType.Slideshow:
                            ProvidersHolder.Instance.Providers.Add(new SlideShowImageProvider(settings, solution));
                            break;

                        default:
                            ProvidersHolder.Instance.Providers.Add(new SingleImageEachProvider(settings, solution));
                            break;
                        }
                    }
                }
                ImageProviders = ProvidersHolder.Instance.Providers;
            }

            if (!string.IsNullOrEmpty(solution))
            {
                if (!ImageProviders.Any(x => x.SolutionConfigFile == solution))
                {
                    switch (settings.ImageBackgroundType)
                    {
                    case ImageBackgroundType.Single:
                        ImageProviders.Add(new SingleImageProvider(settings, solution));
                        break;

                    case ImageBackgroundType.SingleEach:
                        ImageProviders.Add(new SingleImageEachProvider(settings, solution));
                        break;

                    case ImageBackgroundType.Slideshow:
                        ImageProviders.Add(new SlideShowImageProvider(settings, solution));
                        break;

                    default:
                        ImageProviders.Add(new SingleImageEachProvider(settings, solution));
                        break;
                    }
                }
            }

            new ClaudiaIDE(textView, ImageProviders);
        }