void RemoveType() { try { GType type = SelectedType; if (type == null) { return; } TreeNode node = SelectedNode; string s = string.Format("{0} '{1}' ?", Locale.Get("_removetypeconf"), type.Name); if (MessageBox.Show(s, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { StatVisitor sv = new StatVisitor(); type.Visit(sv); Stat stat = sv.Stat; bool removeFlag = true; if (stat.nObjects > 0 || stat.nTypes > 1) { s = string.Format(Locale.Get("_removetypeallconf"), type.Name, stat.nTypes - 1, stat.nObjects); removeFlag = MessageBox.Show(s, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes; } if (removeFlag) { RemoveNode(node); if (App.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = Lib.GetContext()) type.Remove(context); } else { type.Remove(); } if (OnTypeRemoved != null) { OnTypeRemoved(this, new TypeEventArgs(type)); } app.CheckRepaint(type); } } } catch (Exception ex) { Log.Exception(ex); } }