Пример #1
0
        public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
        {
            if (viewContent.SecondaryViewContents.Any(c => c is FormsDesignerViewContent))
            {
                return(new IViewContent[0]);
            }

            string fileExtension = String.Empty;
            string fileName      = viewContent.PrimaryFileName;

            fileExtension = Path.GetExtension(fileName).ToLowerInvariant();

            IDesignerLoaderProvider loader;
            IDesignerGenerator      generator;

            switch (fileExtension)
            {
            case ".cs":
                loader    = new NRefactoryDesignerLoaderProvider(SupportedLanguage.CSharp);
                generator = new CSharpDesignerGenerator();
                break;

            case ".vb":
                loader    = new NRefactoryDesignerLoaderProvider(SupportedLanguage.VBNet);
                generator = new VBNetDesignerGenerator();
                break;

            default:
                throw new ApplicationException("Cannot create content for " + fileExtension);
            }
            return(new IViewContent[] { new FormsDesignerViewContent(viewContent, loader, generator) });
        }
		public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
		{
			if (viewContent.SecondaryViewContents.Any(c => c is FormsDesignerViewContent)) {
				return new IViewContent[0];
			}
			
			string fileExtension = String.Empty;
			string fileName      = viewContent.PrimaryFileName;
			
			fileExtension = Path.GetExtension(fileName).ToLowerInvariant();
			
			IDesignerLoaderProvider loader;
			IDesignerGenerator generator;
			
			switch (fileExtension) {
				case ".cs":
					loader    = new NRefactoryDesignerLoaderProvider(SupportedLanguage.CSharp);
					generator = new CSharpDesignerGenerator();
					break;
				case ".vb":
					loader    = new NRefactoryDesignerLoaderProvider(SupportedLanguage.VBNet);
					generator = new VBNetDesignerGenerator();
					break;
				default:
					throw new ApplicationException("Cannot create content for " + fileExtension);
			}
			return new IViewContent[] { new FormsDesignerViewContent(viewContent, loader, generator) };
		}