private void bRemove_Click(object sender, EventArgs e) { if (treeView.SelectedNode == null) { return; } if (MessageBox.Show($"Вы хотите удалить {(treeView.SelectedNode.Tag is ITechProcess ? "техпроцесс" : "операцию")} '{treeView.SelectedNode.Text}'?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { switch (treeView.SelectedNode.Tag) { case ITechProcess techProcess: _camDocument.DeleteTechProcess(techProcess); break; case TechOperationBase techOperation: _camDocument.DeleteTechOperation(techOperation); break; } Acad.SelectObjectIds(); ClearParamsViews(); treeView.SelectedNode.Remove(); RefreshToolButtonsState(); } }
private void Delete() { if (treeView.SelectedNode == null) { return; } if (MessageBox.Show($"Вы хотите удалить {(treeView.SelectedNode.Tag is ITechProcess ? "техпроцесс" : "операцию")} '{treeView.SelectedNode.Text}'?", "Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { switch (treeView.SelectedNode.Tag) { case ITechProcess techProcess: _camDocument.DeleteTechProcess(techProcess); _currentTechProcessType = null; break; case TechOperation techOperation: _camDocument.DeleteTechOperation(CurrentTechProcess, treeView.SelectedNode.Index); break; } Acad.UnhighlightAll(); ClearParamsViews(); tabControl.SelectedTab = tabPageParams; treeView.SelectedNode.Remove(); treeView.Focus(); RefreshToolButtonsState(); } }