String IMarkupFormatter.Doctype(IDocumentType doctype)
 {
     return String.Concat(
         IntendBefore(doctype.PreviousSibling),
         HtmlMarkupFormatter.Instance.Doctype(doctype),
         NewLineAfter(doctype.NextSibling));
 }
 String IMarkupFormatter.Doctype(IDocumentType doctype)
 {
     var publicId = doctype.PublicIdentifier;
     var systemId = doctype.SystemIdentifier;
     var noExternalId = String.IsNullOrEmpty(publicId) && String.IsNullOrEmpty(systemId);
     var externalId = noExternalId ? String.Empty : " " + (String.IsNullOrEmpty(publicId) ?
         String.Concat("SYSTEM \"", systemId, "\"") :
         String.Concat("PUBLIC \"", publicId, "\" \"", systemId, "\""));
     return String.Concat("<!DOCTYPE ", doctype.Name, externalId, ">");
 }
        /// <summary>
        /// Creates a DOM Document object of the specified type with its document element.
        /// </summary>
        /// <param name="namespaceUri">Optional: The namespace URI of the document element to create.</param>
        /// <param name="qualifiedName">Optional: The qualified name of the document element to be created.</param>
        /// <param name="doctype">Optional: The type of document to be created.</param>
        /// <returns>A new Document object with its document element.</returns>
        public IXmlDocument CreateDocument(String namespaceUri = null, String qualifiedName = null, IDocumentType doctype = null)
        {
            var doc = new XmlDocument();

            if (doctype != null)
                doc.AppendChild(doctype as Node);

            //doc.NodeName = qualifiedName ?? doc.NodeName;
            return doc;
        }
Exemple #4
0
		public IDocument CreateDocument(string namespaceURI, 
		                                string qualifiedName, 
		                                IDocumentType doctype)
		{
			nsIDOMDocument doc;
			Base.StringSet (storage, namespaceURI);
			UniString qual = new UniString (qualifiedName);
			unmanagedDomImpl.createDocument (storage, qual.Handle, ((DocumentType)doctype).ComObject, out doc);
			control.documents.Add (doc.GetHashCode (), new Document (this.control, doc));
			return control.documents[doc.GetHashCode ()] as IDocument;
			
		}
        public IXmlDocument CreateDocument(String namespaceUri = null, String qualifiedName = null, IDocumentType doctype = null)
        {
            var document = new XmlDocument();

            if (doctype != null)
            {
                document.AppendChild(doctype);
            }

            if (!String.IsNullOrEmpty(qualifiedName))
            {
                var element = document.CreateElement(namespaceUri, qualifiedName);

                if (element != null)
                {
                    document.AppendChild(element);
                }
            }

            document.BaseUrl = _owner.BaseUrl;
            return document;
        }
 void Confirm(IDocumentType docType)
 {
     if (_docType == null)
     {
         _docType = docType;
     }
 }
Exemple #7
0
 public ProjectItem(IProject project, Microsoft.Expression.Framework.Documents.DocumentReference documentReference, IDocumentType documentType, IServiceProvider serviceProvider) : base(project, documentReference, documentType, serviceProvider)
 {
     this.UpdateFileInformation();
     base.Project.ItemDeleted += new EventHandler <ProjectItemEventArgs>(this.Project_ItemDeleted);
     base.Project.ItemRemoved += new EventHandler <ProjectItemEventArgs>(this.Project_ItemRemoved);
     base.Project.ItemRenamed += new EventHandler <ProjectItemRenamedEventArgs>(this.Project_ItemRenamed);
 }
Exemple #8
0
 public DocumentRoutedCommand(IDocumentType documentType)
 {
     this.DocumentType = documentType;
 }
        public IEnumerable <IProjectItem> CreateProjectItems(string name, string targetFolder, IProject project, IEnumerable <TemplateArgument> templateArguments, CreationOptions creationOptions, out List <IProjectItem> itemsToOpen, IServiceProvider serviceProvider)
        {
            Uri uri;

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            ICodeDocumentType codeDocumentType = base.GetCodeDocumentType(serviceProvider);

            if (templateArguments != null)
            {
                templateArguments = templateArguments.Concat <TemplateArgument>(TemplateManager.GetDefaultArguments(serviceProvider.ExpressionInformationService()));
            }
            else
            {
                templateArguments = TemplateManager.GetDefaultArguments(serviceProvider.ExpressionInformationService());
            }
            IEnumerable <IProjectItem> projectItems = Enumerable.Empty <IProjectItem>();

            itemsToOpen = new List <IProjectItem>();
            using (ProjectPathHelper.TemporaryDirectory temporaryDirectory = new ProjectPathHelper.TemporaryDirectory(true))
            {
                Uri uri1 = new Uri(Microsoft.Expression.Framework.Documents.PathHelper.EnsurePathEndsInDirectorySeparator(temporaryDirectory.Path));
                List <DocumentCreationInfo> documentCreationInfos = new List <DocumentCreationInfo>();
                List <string> strs = new List <string>();
                bool          flag = false;
                foreach (VSTemplateTemplateContentProjectItem templateProjectItem in this.TemplateProjectItems)
                {
                    if (!templateProjectItem.OpenInEditorSpecified)
                    {
                        continue;
                    }
                    flag = true;
                    break;
                }
                bool             flag1             = false;
                string           str               = CodeGenerator.MakeSafeIdentifier(codeDocumentType, project.DocumentReference.DisplayNameShort, flag1);
                bool             flag2             = true;
                string           str1              = CodeGenerator.MakeSafeIdentifier(codeDocumentType, project.DocumentReference.DisplayNameShort, flag2);
                TemplateArgument templateArgument  = new TemplateArgument("safeprojectname", str);
                TemplateArgument templateArgument1 = new TemplateArgument("safeprojectname", str1);
                TemplateArgument templateArgument2 = new TemplateArgument("assemblyname", project.DocumentReference.DisplayNameShort);
                TemplateArgument templateArgument3 = new TemplateArgument("safeassemblyname", project.DocumentReference.DisplayNameShort.Replace(' ', '\u005F'));
                foreach (VSTemplateTemplateContentProjectItem vSTemplateTemplateContentProjectItem in this.TemplateProjectItems)
                {
                    string targetFileName = vSTemplateTemplateContentProjectItem.TargetFileName;
                    if (string.IsNullOrEmpty(targetFileName))
                    {
                        targetFileName = vSTemplateTemplateContentProjectItem.Value;
                    }
                    TemplateArgument[]             templateArgumentArray = new TemplateArgument[] { new TemplateArgument("fileinputname", Path.GetFileNameWithoutExtension(name)), new TemplateArgument("fileinputextension", Path.GetExtension(name)) };
                    IEnumerable <TemplateArgument> templateArguments1    = templateArgumentArray;
                    targetFileName     = TemplateParser.ReplaceTemplateArguments(targetFileName, templateArguments1);
                    templateArguments1 = templateArguments1.Concat <TemplateArgument>(templateArguments);
                    bool   flag3 = Path.GetExtension(vSTemplateTemplateContentProjectItem.Value).Equals(codeDocumentType.DefaultFileExtension, StringComparison.OrdinalIgnoreCase);
                    string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(Microsoft.Expression.Framework.Documents.PathHelper.GetFileOrDirectoryName(targetFileName));
                    if (serviceProvider.DocumentTypeManager().DocumentTypes[DocumentTypeNamesHelper.Xaml].IsDocumentTypeOf(fileNameWithoutExtension))
                    {
                        fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileNameWithoutExtension);
                    }
                    string str2 = CodeGenerator.MakeSafeIdentifier(codeDocumentType, fileNameWithoutExtension, flag3);
                    IEnumerable <TemplateArgument> templateArguments2     = templateArguments1;
                    TemplateArgument[]             templateArgumentArray1 = new TemplateArgument[] { new TemplateArgument("rootnamespace", project.DefaultNamespaceName), new TemplateArgument("projectname", project.DocumentReference.DisplayNameShort), templateArgument2, templateArgument3, null, null, null, null };
                    templateArgumentArray1[4] = (flag3 ? templateArgument1 : templateArgument);
                    templateArgumentArray1[5] = new TemplateArgument("safeitemname", str2);
                    templateArgumentArray1[6] = new TemplateArgument("safeitemrootname", str2);
                    templateArgumentArray1[7] = new TemplateArgument("culture", (string.IsNullOrEmpty(project.UICulture) ? CultureInfo.CurrentUICulture.ToString() : project.UICulture));
                    templateArguments1        = templateArguments2.Concat <TemplateArgument>(templateArgumentArray1);
                    try
                    {
                        uri = base.ResolveFileUri(targetFileName, uri1);
                    }
                    catch (UriFormatException uriFormatException)
                    {
                        continue;
                    }
                    IDocumentType documentType = project.GetDocumentType(targetFileName);
                    foreach (IDocumentType documentType1 in serviceProvider.DocumentTypeManager().DocumentTypes)
                    {
                        if (vSTemplateTemplateContentProjectItem.SubType != documentType1.Name)
                        {
                            continue;
                        }
                        documentType = documentType1;
                    }
                    if (!base.CreateFile(vSTemplateTemplateContentProjectItem.Value, base.TemplateLocation, uri, vSTemplateTemplateContentProjectItem.ReplaceParameters, templateArguments1))
                    {
                        continue;
                    }
                    string str3 = ProjectItemTemplate.AdjustTargetFolder(targetFolder, uri1.LocalPath, uri.LocalPath);
                    DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo()
                    {
                        SourcePath      = uri.LocalPath,
                        TargetFolder    = str3,
                        DocumentType    = documentType,
                        CreationOptions = creationOptions
                    };
                    documentCreationInfos.Add(documentCreationInfo);
                    if (!flag)
                    {
                        if (strs.Count > 0)
                        {
                            continue;
                        }
                        strs.Add(Path.Combine(str3, Path.GetFileName(uri.LocalPath)));
                    }
                    else
                    {
                        if (!vSTemplateTemplateContentProjectItem.OpenInEditor)
                        {
                            continue;
                        }
                        strs.Add(Path.Combine(str3, Path.GetFileName(uri.LocalPath)));
                    }
                }
                if (documentCreationInfos.Count > 0)
                {
                    projectItems = project.AddItems(documentCreationInfos);
                }
                if (projectItems.Any <IProjectItem>())
                {
                    for (int i = 0; i < strs.Count; i++)
                    {
                        IProjectItem projectItem = projectItems.FirstOrDefault <IProjectItem>((IProjectItem item) => item.DocumentReference.Path.Equals(strs[i], StringComparison.OrdinalIgnoreCase));
                        if (projectItem != null)
                        {
                            itemsToOpen.Add(projectItem);
                        }
                    }
                    projectItems = projectItems.Concat <IProjectItem>(this.AddAssemblies(project));
                }
            }
            if (base.BuildOnLoad)
            {
                IProjectManager      projectManager    = serviceProvider.ProjectManager();
                IProjectBuildContext activeBuildTarget = projectManager.ActiveBuildTarget;
                projectManager.BuildManager.Build(activeBuildTarget, null, true);
                KnownProjectBase knownProjectBase = project as KnownProjectBase;
                if (knownProjectBase != null)
                {
                    knownProjectBase.CheckForChangedOrDeletedItems();
                }
            }
            return(projectItems);
        }
 protected Document(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException("documentType"); }
     this.documentType = documentType;
 }
 public NewDocumentEventHandler(DocumentService documentService, IDocumentType documentType)
 {
     this.documentService = documentService;
     this.documentType = documentType;
 }
Exemple #12
0
 public string Doctype(IDocumentType doctype) => HtmlMarkupFormatter.Instance.Doctype(doctype);
 /// <summary>
 /// Creates a new instance of the auto selected markup formatter.
 /// </summary>
 /// <param name="docType">
 /// Optional DocumentType to hint the implementation to use.
 /// </param>
 public AutoSelectedMarkupFormatter(IDocumentType docType = null)
 {
     _docType = docType;
 }
 /// <summary>
 /// Formats the given doctype using the name, public and system
 /// identifiers.
 /// </summary>
 /// <param name="doctype">The document type to stringify.</param>
 /// <returns>The formatted doctype.</returns>
 public String Doctype(IDocumentType doctype)
 {
     Confirm(doctype);
     return(ChildFormatter.Doctype(doctype));
 }
Exemple #15
0
 public string Doctype(IDocumentType doctype) => _formatter.Doctype(doctype);
Exemple #16
0
 public DocumentTypeController(IDocumentType documentType)
 {
     _documentType = documentType;
 }
Exemple #17
0
        /// <summary>
        /// Creates a DOM Document object of the specified type with its document element.
        /// </summary>
        /// <param name="namespaceUri">Optional: The namespace URI of the document element to create.</param>
        /// <param name="qualifiedName">Optional: The qualified name of the document element to be created.</param>
        /// <param name="doctype">Optional: The type of document to be created.</param>
        /// <returns>A new Document object with its document element.</returns>
        public IXmlDocument CreateDocument(String namespaceUri = null, String qualifiedName = null, IDocumentType doctype = null)
        {
            var doc = new XmlDocument();

            if (doctype != null)
            {
                doc.AppendChild(doctype);
            }

            if (!String.IsNullOrEmpty(qualifiedName))
            {
                var element = doc.CreateElement(namespaceUri, qualifiedName);

                if (element != null)
                {
                    doc.AppendChild(element);
                }
            }

            doc.BaseUrl = _owner.BaseUrl;
            return(doc);
        }
Exemple #18
0
        public void Load(IServices services)
        {
            this.services = services;
            ICommandService service1 = this.services.GetService <ICommandService>();

            this.services.GetService <IDocumentService>();
            IDocumentTypeManager   service2         = this.services.GetService <IDocumentTypeManager>();
            IViewService           service3         = this.services.GetService <IViewService>();
            IProjectManager        service4         = this.services.GetService <IProjectManager>();
            IAssemblyService       service5         = this.services.GetService <IAssemblyService>();
            IMessageDisplayService service6         = this.services.GetService <IMessageDisplayService>();
            IWindowService         service7         = this.services.GetService <IWindowService>();
            CodeOptionsModel       codeOptionsModel = new CodeOptionsModel();

            this.editingService = new EditingService((IServiceProvider)this.services, codeOptionsModel);
            this.services.AddService(typeof(ITextEditorService), (object)this.editingService);
            this.services.AddService(typeof(ITextBufferService), (object)this.editingService);
            ICodeProjectService codeProjectService = (ICodeProjectService) new CodeProjectService(service4, service5, service6, service3, service2);

            this.services.AddService(typeof(ICodeModelService), (object)new CodeModelService(this.services, codeProjectService));
            if (service2 != null)
            {
                this.csharpDocumentType = (IDocumentType) new CSharpDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.csharpDocumentType);
                this.visualBasicDocumentType = (IDocumentType) new VisualBasicDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.visualBasicDocumentType);
                this.javascriptDocumentType = (IDocumentType) new JavascriptDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.javascriptDocumentType);
                this.fSharpDocumentType = (IDocumentType) new FSharpDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.fSharpDocumentType);
                this.fSharpScriptDocumentType = (IDocumentType) new FSharpScriptDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.fSharpScriptDocumentType);
                this.fSharpTemplateDocumentType = (IDocumentType) new FSharpTemplateDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.fSharpTemplateDocumentType);
                this.cPlusPlusDocumentType = (IDocumentType) new CPlusPlusDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.cPlusPlusDocumentType);
                this.headerDocumentType = (IDocumentType) new HeaderDocumentType(codeProjectService, service3, codeOptionsModel, service7);
                service2.Register(this.headerDocumentType);
                this.htmlDocumentType = (IDocumentType) new HTMLDocumentType(this.editingService);
                service2.Register(this.htmlDocumentType);
                this.xmlDocumentType = (IDocumentType) new XmlDocumentType(this.editingService);
                service2.Register(this.xmlDocumentType);
                this.limitedXamlDocumentType = (IDocumentType) new LimitedXamlDocumentType(this.editingService);
                service2.Register(this.limitedXamlDocumentType);
                this.fxgDocumentType = (IDocumentType) new FxgDocumentType(this.editingService);
                service2.Register(this.fxgDocumentType);
            }
            IOptionsDialogService service8 = this.services.GetService <IOptionsDialogService>();

            if (service8 != null)
            {
                this.codeOptionsPage = (IOptionsPage) new CodeOptionsPage(this.editingService);
                service8.OptionsPages.Add(this.codeOptionsPage);
            }
            if (service1 == null)
            {
                return;
            }
            this.commandTarget = new CommandTarget();
            this.commandTarget.AddCommand("Project_EditVisualStudio", (ICommand) new EditVisualStudioCommand(service4, service1, service6));
            service1.AddTarget((ICommandTarget)this.commandTarget);
        }
Exemple #19
0
 internal IDocument New(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException(nameof(documentType)); }
     if (!documentTypes.Contains(documentType))
     {
         throw new ArgumentException("documentType is not an item of the DocumentTypes collection.");
     }
     IDocument document = documentType.New();
     fileService.AddDocument(document);
     ActiveDocument = document;
     return document;
 }
 /// <summary>
 /// 新建指定文档类型的文档
 /// </summary>
 /// <param name="documentType">文档类型.</param>
 public void New(IDocumentType documentType)
 {
     IDocumentFactory factory = (IDocumentFactory)documentType;
     IDocumentHandler document = factory.New();
     if (document != null) {
         InitializeDocument(document);
     }
 }
Exemple #21
0
        private void SaveCore(IDocumentType documentType, IDocument document, string fileName)
        {
            try
            {
                documentType.Save(document, fileName);
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
                messageService.ShowError(shellService.ShellView, string.Format(CultureInfo.CurrentCulture, Resources.CannotSaveFile, fileName));
            }

            if (documentType.CanOpen()) { recentFileList.AddFile(fileName); }
        }
 public IDocument New(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException("documentType"); }
     if (!documentTypes.Contains(documentType))
     {
         throw new ArgumentException("documentType is not an item of the DocumentTypes collection.");
     }
     IDocument document = documentType.New();
     documents.Add(document);
     ActiveDocument = document;
     return document;
 }
Exemple #23
0
 protected Document(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException(nameof(documentType)); }
     DocumentType = documentType;
 }
 private void SaveCore(IDocumentType documentType, IDocument document)
 {
     try
     {
         documentType.Save(document, document.FullFilePath);
     }
     catch (Exception e)
     {
         Trace.TraceError(e.ToString());
         messageService.ShowError(shellService.ShellView,
             string.Format(CultureInfo.CurrentCulture, Resources.CannotSaveFile, document.FullFilePath));
     }
 }
Exemple #25
0
 public ProjectReferenceProjectItem(IProject project, Microsoft.Expression.Framework.Documents.DocumentReference documentReference, IDocumentType documentType, IServiceProvider serviceProvider) : base(project, documentReference, documentType, serviceProvider)
 {
 }
Exemple #26
0
 public ImportedContentDescriptor(object importedContent, IDocumentType documentType)
 {
     this.ImportedContent = importedContent;
     this.DocumentType    = documentType;
 }
 string IMarkupFormatter.Doctype(IDocumentType doctype)
 {
     return(string.Empty);
 }
Exemple #28
0
 protected Document(IDocumentType documentType)
 {
     DocumentType = documentType ?? throw new ArgumentNullException(nameof(documentType));
 }
Exemple #29
0
 public string Doctype(IDocumentType doctype)
 {
     return(string.Empty);
 }
Exemple #30
0
        private void PasteResource()
        {
            int index = -1;
            ResourceContainer container = (ResourceContainer)null;

            if (this.resourceManager.SelectedResourceContainers.Count == 1)
            {
                container = this.resourceManager.SelectedResourceContainers[0];
                index     = container.ResourceItems.Count;
            }
            else if (this.resourceManager.SelectedResourceItems.Count == 1)
            {
                ResourceItem resourceItem = this.resourceManager.SelectedResourceItems[0];
                container = resourceItem.Container;
                index     = container.ResourceItems.IndexOf(resourceItem) + 1;
            }
            SafeDataObject dataObject = SafeDataObject.FromClipboard();

            if (index < 0)
            {
                return;
            }
            SceneViewModel viewModel    = container.ViewModel;
            PastePackage   pastePackage = PastePackage.FromData(viewModel, dataObject);

            if (pastePackage != null)
            {
                if (pastePackage.Elements.Count > 0)
                {
                    viewModel.DesignerContext.MessageDisplayService.ShowError(StringTable.PasteResourcesFailedElementsFoundDialogMessage);
                }
                else
                {
                    IDictionary <DocumentNode, string> imageMap = (IDictionary <DocumentNode, string>) new Dictionary <DocumentNode, string>();
                    foreach (SceneNode sceneNode in pastePackage.Resources)
                    {
                        foreach (KeyValuePair <DocumentNode, string> keyValuePair in (IEnumerable <KeyValuePair <DocumentNode, string> >)Microsoft.Expression.DesignSurface.Utility.ResourceHelper.CreateImageReferenceMap(sceneNode.DocumentNode, pastePackage, viewModel))
                        {
                            imageMap.Add(keyValuePair);
                        }
                    }
                    using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.UndoUnitPaste))
                    {
                        Microsoft.Expression.DesignSurface.Utility.ResourceHelper.PasteResources(pastePackage, imageMap, ResourceConflictResolution.RenameNew | ResourceConflictResolution.OverwriteOld, container.Node, index, true);
                        editTransaction.Commit();
                    }
                }
            }
            else if (dataObject.GetDataPresent(DataFormats.FileDrop))
            {
                DesignerContext designerContext        = viewModel.DesignerContext;
                IDocumentType[] supportedDocumentTypes = new IDocumentType[1]
                {
                    designerContext.DocumentTypeManager.DocumentTypes[DocumentTypeNamesHelper.Image]
                };
                string[] supportedFiles = new FileDropUtility(designerContext.ProjectManager, (FrameworkElement)null, supportedDocumentTypes).GetSupportedFiles(ClipboardService.GetDataObject());
                if (supportedFiles.Length > 0)
                {
                    foreach (IProjectItem projectItem in designerContext.ActiveProject.AddItems(Enumerable.Select <string, DocumentCreationInfo>((IEnumerable <string>)supportedFiles, (Func <string, DocumentCreationInfo>)(file => new DocumentCreationInfo()
                    {
                        SourcePath = file
                    }))))
                    {
                        this.CreateImageBrushResource(container, projectItem);
                    }
                }
                else
                {
                    designerContext.MessageDisplayService.ShowError(StringTable.PasteElementsFailedDialogMessage);
                }
            }
            else
            {
                if (!dataObject.GetDataPresent(DataFormats.Bitmap))
                {
                    return;
                }
                IProject project = EnumerableExtensions.SingleOrNull <IProject>(this.projectManager.ItemSelectionSet.SelectedProjects);
                if (project == null)
                {
                    return;
                }
                IProjectItem projectItem = CutBuffer.AddImageDataFromClipboard(this.projectManager, project);
                this.CreateImageBrushResource(container, projectItem);
            }
        }
 String IMarkupFormatter.Doctype(IDocumentType doctype)
 {
     var ids = GetIds(doctype.PublicIdentifier, doctype.SystemIdentifier);
     return String.Concat("<!DOCTYPE ", doctype.Name, ids, ">");
 }
 /// <summary>
 /// Formats the given doctype using the name, public and system
 /// identifiers.
 /// </summary>
 /// <param name="doctype">The document type to stringify.</param>
 /// <returns>The formatted doctype.</returns>
 public String Doctype(IDocumentType doctype)
 {
     Confirm(doctype);
     return ChildFormatter.Doctype(doctype);
 }
Exemple #33
0
        String IMarkupFormatter.Doctype(IDocumentType doctype)
        {
            var ids = GetIds(doctype.PublicIdentifier, doctype.SystemIdentifier);

            return(String.Concat("<!DOCTYPE ", doctype.Name, ids, ">"));
        }
 /// <summary>
 /// Creates a new instance of the auto selected markup formatter.
 /// </summary>
 /// <param name="docType">
 /// Optional DocumentType to hint the implementation to use.
 /// </param>
 public AutoSelectedMarkupFormatter(IDocumentType docType = null)
 {
     _docType = docType;
 }
 public NewDocumentEventHandler(DocumentService documentService, IDocumentType documentType)
 {
     this.documentService = documentService;
     this.documentType    = documentType;
 }
        /// <inheritdoc />
        public virtual String Doctype(IDocumentType doctype)
        {
            var ids = GetIds(doctype.PublicIdentifier, doctype.SystemIdentifier);

            return(String.Concat("<!DOCTYPE ", doctype.Name, ids, ">"));
        }
Exemple #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentCreatedEventContext"/> class.
 /// </summary>
 /// <param name="destinationFolderPath">The destination folder path.</param>
 /// <param name="documentType">The document type.</param>
 /// <param name="rootProperties">The properties of the root object.</param>
 public DocumentCreatedEventContext(IFolderPath destinationFolderPath, IDocumentType documentType, IRootProperties rootProperties)
 {
     this.DestinationFolderPath = destinationFolderPath;
     this.DocumentType          = documentType;
     this.RootProperties        = rootProperties;
 }
Exemple #38
0
 public AssemblyProjectItem(IProject project, Microsoft.Expression.Framework.Documents.DocumentReference documentReference, IDocumentType documentType, IServiceProvider serviceProvider) : base(project, documentReference, documentType, serviceProvider)
 {
     this.UpdateGlobalAssemblyCacheProperty();
 }
Exemple #39
0
 public string Doctype(IDocumentType doctype)
 {
     return(defaultFormatter.Doctype(doctype));
 }
Exemple #40
0
        public static IXmlDocument CreateDocument(this IImplementation impl, String namespaceUri = null, String qualifiedName = null, IDocumentType doctype = null)
        {
            var document = new XmlDocument();
            var ownerRef = impl.CreateDocumentType("xml", String.Empty, String.Empty);

            if (doctype != null)
            {
                document.AppendChild(doctype);
            }

            if (!String.IsNullOrEmpty(qualifiedName))
            {
                var element = document.CreateElement(namespaceUri, qualifiedName);

                if (element != null)
                {
                    document.AppendChild(element);
                }
            }

            document.BaseUrl = ownerRef.BaseUrl;
            return(document);
        }
Exemple #41
0
        public void Load(IServices services)
        {
            this.services = services;
            ICommandService service = (ICommandService)this.services.GetService(typeof(ICommandService));
            IExpressionMefHostingService expressionMefHostingService = this.services.GetService <IExpressionMefHostingService>();
            IDocumentTypeManager         documentTypeManager         = new DocumentTypeManager(new UnknownDocumentType());

            this.services.AddService(typeof(IDocumentTypeManager), documentTypeManager);
            IProjectTypeManager projectTypeManager = new ProjectTypeManager();

            this.services.AddService(typeof(IProjectTypeManager), projectTypeManager);
            IConfigurationService configurationService = this.services.GetService <IConfigurationService>();
            ProjectManager        projectManager       = new ProjectManager(this.services, configurationService["ProjectManager"]);

            this.services.AddService(typeof(IProjectManager), projectManager);
            service.AddTarget(projectManager);
            this.services.AddService(typeof(IExternalChanges), projectManager);
            this.solutionService = new SolutionService(projectManager);
            this.services.AddService(typeof(ISolutionService), this.solutionService);
            this.assemblyLoggingService = new AssemblyLoggingService(configurationService.ConfigurationDirectoryPath);
            this.services.AddService(typeof(IAssemblyLoggingService), this.assemblyLoggingService);
            IProjectAdapterService projectAdapterService = new ProjectAdapterService(this.services);

            this.services.AddService(typeof(IProjectAdapterService), projectAdapterService);
            if (expressionMefHostingService != null)
            {
                expressionMefHostingService.AddInternalPart(projectAdapterService);
                expressionMefHostingService.AddInternalPart(this.solutionService);
            }
            IOptionsDialogService optionsDialogService = this.services.GetService <IOptionsDialogService>();

            this.projectSystemOptionsPage = new ProjectSystemOptionsPage(projectManager, this.assemblyLoggingService);
            optionsDialogService.OptionsPages.Add(this.projectSystemOptionsPage);
            this.assemblyDocumentType = new AssemblyDocumentType();
            documentTypeManager.Register(this.assemblyDocumentType);
            this.projectReferenceDocumentType = new ProjectReferenceDocumentType();
            documentTypeManager.Register(this.projectReferenceDocumentType);
            this.folderDocumentType = new FolderDocumentType();
            documentTypeManager.Register(this.folderDocumentType);
            this.comReferenceDocumentType = new ComReferenceDocumentType();
            documentTypeManager.Register(this.comReferenceDocumentType);
            this.cursorDocumentType = new CursorDocumentType();
            documentTypeManager.Register(this.cursorDocumentType);
            this.deepZoomDocumentType = new DeepZoomDocumentType();
            documentTypeManager.Register(this.deepZoomDocumentType);
            this.websiteProjectType = new WebsiteProjectType();
            projectTypeManager.Register(this.websiteProjectType);
            this.webApplicationProjectType = new WebApplicationProjectType();
            projectTypeManager.Register(this.webApplicationProjectType);
            this.assemblyService = new AssemblyService(this.services);
            this.services.AddService(typeof(IAssemblyService), this.assemblyService);
            this.services.AddService(typeof(ISatelliteAssemblyResolver), this.assemblyService);
            this.blendSdkAssemblyResolver = new BlendSdkAssemblyResolver();
            this.assemblyService.RegisterLibraryResolver(this.blendSdkAssemblyResolver);
            this.blendAssemblyResolver = new BlendAssemblyResolver();
            this.assemblyService.RegisterLibraryResolver(this.blendAssemblyResolver);
            Microsoft.Expression.Framework.UserInterface.IWindowService windowService = this.services.GetService <Microsoft.Expression.Framework.UserInterface.IWindowService>();
            windowService.Closing += new CancelEventHandler(this.WindowManager_Closing);
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new DispatcherOperationCallback((object o) => {
                Application.Current.SessionEnding += new SessionEndingCancelEventHandler(this.Current_SessionEnding);
                return(null);
            }), null);
            UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.SystemIdle, new Action(this.assemblyService.AssemblyCache.Clean));
        }
 private static string AppendFilter(string filter, IDocumentType extension)
 {
     if (!String.IsNullOrEmpty(filter)) { filter += "|"; }
     filter += extension.Description + "|*" + extension.Extension;
     return filter;
 }
Exemple #43
0
 string IMarkupFormatter.Doctype(IDocumentType doctype) => string.Empty;
 public void Deregister(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException("documentType"); }
     if (documents.Any(d => d.DocumentType == documentType))
     {
         throw new InvalidOperationException("It's not possible to deregister a document type which is still used by some documents.");
     }
     documentTypes.Remove(documentType);
 }
Exemple #45
0
 public FolderProjectItem(IProject project, Microsoft.Expression.Framework.Documents.DocumentReference documentReference, IDocumentType documentType, IServiceProvider serviceProvider, bool isBlockingFolder) : this(project, documentReference, documentType, serviceProvider, isBlockingFolder, null)
 {
 }
 public void Register(IDocumentType documentType)
 {
     if (documentType == null) { throw new ArgumentNullException("documentType"); }
     documentTypes.Add(documentType);
 }
Exemple #47
0
 public FolderProjectItem(IProject project, Microsoft.Expression.Framework.Documents.DocumentReference documentReference, IDocumentType documentType, IServiceProvider serviceProvider, bool isBlockingFolder, ImageSource image) : base(project, documentReference, documentType, serviceProvider)
 {
     this.IsUIBlockingFolder = isBlockingFolder;
     this.overrideImage      = image;
 }
 public DocumentTypeViewModel (IDocumentType documentType, ViewModelContext context)
 {
     CopyCstor.Copy<IDocumentType> (documentType, this);
     Context = context;
 }
        public static SystemDocumentType GetSystemDocumentType(this IDocumentType documentType)
        {
            SystemDocumentType result;

            return(Enum.TryParse <SystemDocumentType> (documentType.Type, out result) ? result : SystemDocumentType.Custom);
        }
Exemple #50
0
 public virtual string Doctype(IDocumentType doctype)
 {
     return(HtmlMarkupFormatter.Instance.Doctype(doctype));
 }
 public string Doctype(IDocumentType doctype) => string.Empty;