Exemple #1
0
        /// <summary>
        /// Creates the template in the specified document
        /// </summary>
        /// <remarks>
        /// This method will call the CreateTemplate method.
        /// The call will be embraced in a transaction with the specified TransactionDescription
        /// </remarks>
        /// <param name="document">document in which to create the template</param>
        /// <returns>true if the template was successfully created, otherwise false</returns>
        public virtual bool Create(NDrawingDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            document.StartHistoryTransaction(m_sTransactionDescription);

            try
            {
                CreateTemplate(document);
            }
            catch (Exception ex)
            {
                NTrace.WriteLine("Failed to create template. Exception was: " + ex.Message);
                document.RollbackHistoryTransaction();
                return(false);
            }

            document.CommitHistoryTransaction();
            return(true);
        }