Beispiel #1
0
 /// <summary>
 /// Performs a boolean match between two DocumentTypes.
 /// Returns true if they match.
 /// </summary>
 /// <param name="documentType">A DocumentType.</param>
 /// <returns>True if the DocumentTypes are the same.</returns>
 public bool Matches(DocumentType documentType)
 {
     if (documentType == null)
     {
         return(false);
     }
     return(_documentType == documentType.ToString());
 }
        /// <summary>
        /// Gets the open document handler registered for a document type specified
        /// as a DocumentType object.
        /// </summary>
        /// <param name="documentType">The document type.</param>
        /// <returns>The open document handler registered for the document type.</returns>
        public OpenDocumentHandler GetOpenDocumentHandler(
            DocumentType documentType)
        {
            if (documentType == null)
            {
                return(null);
            }

            return(GetOpenDocumentHandler(documentType.ToString()));
        }
Beispiel #3
0
 /// <summary>
 /// Performs a string comparison between two DocumentTypes.
 /// Returns 0 if they match.
 /// </summary>
 /// <param name="documentType">A DocumentType.</param>
 /// <returns>Returns 0 if the document types are the same.</returns>
 public int CompareTo(DocumentType documentType)
 {
     return(_documentType.CompareTo(documentType.ToString()));
 }
        /*
         * Removal.
         */

        /// <summary>
        /// Unregisters the handler registered for a document type specified as a
        /// DocumentType object.
        /// </summary>
        /// <param name="documentType">The document type.</param>
        /// <returns>The open document handler or null if the document type is invalid or
        /// no handler exists for the type.</returns>
        public OpenDocumentHandler RemoveOpenDocumentHandler(
            DocumentType documentType)
        {
            return(RemoveOpenDocumentHandler(documentType.ToString()));
        }
        /*
         * Registration.
         */

        /// <summary>
        /// Registers an open document handler for a document type provided as a DocumentType object.
        /// A handler will be rejected if a handler has already been registered for the document type.
        /// </summary>
        /// <param name="documentType">The document type to be opened by the handler.</param>
        /// <param name="handler">The handler used to open documents of the registered type.</param>
        /// <returns>True if the handler was registered successfully.</returns>
        public bool RegisterOpenDocumentHandler(
            DocumentType documentType, OpenDocumentHandler handler)
        {
            return(RegisterOpenDocumentHandler(
                       documentType.ToString(), handler));
        }