protected override void CommandUpdate(object target, CommandInfo cinfo) { NodeCommandHandler nc = (NodeCommandHandler)target; base.CommandUpdate(target, cinfo); if (nc.MultipleSelectedNodes) { bool allowMulti = false; ICommandUpdateHandler h = ((ICommandUpdateHandler)this).Next; while (h != null) { if (h is AllowMultiSelectionAttribute) { allowMulti = true; break; } h = h.Next; } if (!allowMulti) { cinfo.Enabled = false; } } }
protected override void Run(object target, Command cmd) { NodeCommandHandler nch = (NodeCommandHandler)target; if (nch.tree == null) { base.Run(target, cmd); return; } try { nch.tree.LockUpdates(); base.Run(target, cmd); } finally { nch.tree.UnlockUpdates(); } }