private void tsbDelete_Click(object sender, EventArgs e) { DialogResult dialogResult; if (templatesMenager.ActiveNodeType == TemplatesManager.FolderType.Folder) { dialogResult = MessageBox.Show("Delete selected category", "Confirm delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); } else if (templatesMenager.ActiveNodeType == TemplatesManager.FolderType.File) { dialogResult = MessageBox.Show("Delete selected template", "Confirm delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); } else { dialogResult = DialogResult.Cancel; } if (dialogResult == DialogResult.OK) { templatesMenager.Delete(); templatesMenager.LoadAll(); } }