コード例 #1
0
ファイル: DocumentManager.cs プロジェクト: vtaran/Dynamo
        /// <summary>
        /// Delete an element from the current document given the ElementUUID
        /// </summary>
        /// <param name="element">The UUID of the element to delete</param>
        public void DeleteElement(ElementUUID element)
        {
            TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument);

            CurrentDBDocument.Delete(ElementBinder.GetIdForUUID(CurrentDBDocument, element));

            TransactionManager.Instance.TransactionTaskDone();
        }
コード例 #2
0
ファイル: DocumentManager.cs プロジェクト: vtaran/Dynamo
        public void DeleteElement(ElementId element)
        {
            TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument);

            try
            {
                CurrentDBDocument.Delete(element);
            }
            catch (Exception e)
            {
                LogError(e);
            }

            TransactionManager.Instance.TransactionTaskDone();
        }
コード例 #3
0
        /// <summary>
        /// Delete an element from the current document given the ElementUUID
        /// </summary>
        /// <param name="element">The UUID of the element to delete</param>
        public void DeleteElement(ElementUUID element)
        {
            ElementId id = ElementBinder.GetIdForUUID(CurrentDBDocument, element);

            if (null != id)
            {
                TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument);
                try
                {
                    CurrentDBDocument.Delete(id);
                }
                catch (Exception e)
                {
                    var ele = CurrentDBDocument.GetElement(id);
                    throw new ArgumentException(String.Format("This Element {0} {1} cannot be deleted", ele.ToString(), ele.Name));
                }

                TransactionManager.Instance.TransactionTaskDone();
            }
        }
コード例 #4
0
ファイル: DocumentManager.cs プロジェクト: hipigod/Dynamo
        /// <summary>
        /// Determine if Element exists in the current document
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool ElementExistsInDocument(ElementUUID id)
        {
            Element e;

            return(CurrentDBDocument.TryGetElement(id.UUID, out e));
        }