Esempio n. 1
0
        /// <summary>
        /// Performs the actions on a certain queue item.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="doc"></param>
        private void ProcessQueueItem(RevitQueueItem item, Document doc)
        {
            string dllLocation = item.DllLocation;
            string className = item.ClassName;
            //foreach of those.
            //load the dll with reflection
            Type type = LoadDllWithReflection(dllLocation, className);
            IRemoteCommand command = GetCommandFromType(type);

            //Check for transaction attribute, start one if automatic
            Transaction transaction = StartAutomaticTransaction(type, doc);

            //run the execute method
            Result result = command.RunRemotely(doc);

            //close the transaction
            if (transaction != null && result == Result.Succeeded)
                transaction.Commit();

            if (transaction != null && (result == Result.Cancelled || result == Result.Failed))
                transaction.RollBack();

            item.MarkComplete();
        }