예제 #1
0
        private void Delete(string commandName)
        {
            OnDeleting(EventArgs.Empty);

            IInstancingContext instancingContext = m_contextRegistry.GetActiveContext <IInstancingContext>();

            if (instancingContext != null &&
                instancingContext.CanDelete())
            {
                ITransactionContext transactionContext = instancingContext.As <ITransactionContext>();
                transactionContext.DoTransaction(
                    delegate
                {
                    instancingContext.Delete();

                    ISelectionContext selectionContext = instancingContext.As <ISelectionContext>();
                    if (selectionContext != null)
                    {
                        selectionContext.Clear();
                    }
                }, commandName);
            }

            OnDeleted(EventArgs.Empty);
        }