Esempio n. 1
0
        /// <summary>
        /// Event handler method for DocumentOpened and DocumentCreated events.
        /// This method will reserve "Project Status" value after document has been opened or created.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void ReservePojectOriginalStatus(Object sender, RevitAPIPostDocEventArgs args)
        {
            // The document associated with the event. Here means which document has been created or opened.
            Document doc = args.Document;

            // Project information is unavailable for Family document.
            if (doc.IsFamilyDocument)
            {
                return;
            }

            // write log file.
            LogManager.WriteLog(args, doc);

            // get the hashCode of this document.
            int docHashCode = doc.GetHashCode();

            // retrieve the current value of "Project Status".
            string currentProjectStatus = RetrieveProjectCurrentStatus(doc);

            // reserve "Project Status" current value in one dictionary, and use this project's hashCode as key.
            documentOriginalStatusDic.Add(docHashCode, currentProjectStatus);

            // write log file.
            LogManager.WriteLog("   Current Project Status: " + currentProjectStatus);
        }
        /// <summary>
        /// Event handler method for DocumentOpened and DocumentCreated events.
        /// 此方法将在打开或创建文档后保留“项目状态”值
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void ReservePojectOriginalStatus(Object sender, RevitAPIPostDocEventArgs args)
        {
            Document doc = args.Document;

            if (doc.IsFamilyDocument)
            {
                return;
            }

            // write log file.
            LogManager.WriteLog(args, doc);

            // get the hashCode of this document.
            int docHashCode = doc.GetHashCode();

            // retrieve the current value of "Project Status".
            string currentProjectStatus = RetrieveProjectCurrentStatus(doc);

            // reserve "Project Status" current value in one dictionary, and use this project's hashCode as key.
            documentOriginalStatusDic.Add(docHashCode, currentProjectStatus);

            // write log file.
            LogManager.WriteLog("   Current Project Status: " + currentProjectStatus);
        }
Esempio n. 3
0
        /// <summary>
        /// Event handler method for DocumentOpened and DocumentCreated events.
        /// This method will reserve "Project Status" value after document has been opened or created.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void ReservePojectOriginalStatus(Object sender, RevitAPIPostDocEventArgs args)
        {
            // The document associated with the event. Here means which document has been created or opened.
            Document doc = args.Document;

            // Project information is unavailable for Family document.
            if (doc.IsFamilyDocument)
            {
                return;
            }

            // write log file.
            LogManager.WriteLog(args, doc);

            // get the hashCode of this document.
            int docHashCode = doc.GetHashCode();

            // retrieve the current value of "Project Status".
            string currentProjectStatus = RetrieveProjectCurrentStatus(doc);
            // reserve "Project Status" current value in one dictionary, and use this project's hashCode as key.
            documentOriginalStatusDic.Add(docHashCode, currentProjectStatus);

            // write log file.
            LogManager.WriteLog("   Current Project Status: " + currentProjectStatus);
        }