private void Update() { Enabled = _command != null && _command.CanExecute(); if (_command != null) { if (_command.MenuText != null) { Text = _command.MenuText; } if (_command.MenuImage != null) { Image = _command.MenuImage; } if (_command.SecondImage != null) { SecondImage = _command.SecondImage; } //null is allowed (CA-147657) ToolTipText = _command.ToolTipText; StarRating = _command.StarRating; } }
protected override void OnClick(EventArgs e) { if (_command != null && _command.CanExecute()) { _command.Execute(); } base.OnClick(e); }
public VMOperationToolStripMenuSubItem(VMOperationCommand command) { Util.ThrowIfParameterNull(command, "command"); Command = command; Enabled = command != null && command.CanExecute(); }