public bool Changed(CmdButton cmd) { if (cmd != null) return ( (Command ?? string.Empty) != (cmd.Command ?? string.Empty) || (Text ?? string.Empty) != (cmd.Text ?? string.Empty) || (Template ?? string.Empty) != (cmd.Template ?? string.Empty) ); return false; }
public CommandEx(CmdButton cmd, string toolTip) { if (cmd != null) { Name = cmd.Name; Command = cmd.Command; Text = cmd.Text; ToolTip = toolTip; Template = cmd.Template; } }
internal CommandEx FindCommandEx(CmdButton cmd) { foreach (CommandEx cx in CommandsEx) { if (cx.Name == cmd.Name) { return(cx); } } return(null); }
public bool Changed(CmdButton cmd) { if (cmd != null) { return( (Command ?? string.Empty) != (cmd.Command ?? string.Empty) || (Text ?? string.Empty) != (cmd.Text ?? string.Empty) || (Template ?? string.Empty) != (cmd.Template ?? string.Empty) ); } return(false); }
private void SetTextCommand(CmdButton cmd) { if (string.IsNullOrEmpty(cmd.Command)) cmd.Command = cmd.Text; else if (string.IsNullOrEmpty(cmd.Text)) cmd.Text = cmd.Command; }
private void SetCmdValue(CmdButton cmd, string value) { value = value ?? string.Empty; string text = cmd.Template as string; if (string.IsNullOrEmpty(text)) { text = cmd.Command.Trim(); if (string.IsNullOrEmpty(text)) text = cmd.Text.Trim(); int idx; if ((idx = text.IndexOf('=')) > 0) text = text.Substring(0, idx + 1) + "#VALUE"; } if (!string.IsNullOrEmpty(text) && text.IndexOf("#VALUE") >= 0) { if (string.IsNullOrEmpty(cmd.Template)) cmd.Template = text; cmd.Command = text.Replace("#VALUE", value); } }
private void PrepareCmdEdit(CmdButton cmd) { if (cmd != null) { CancelCmdEdit(); ButtonDefEdit.XButton = cmd; ButtonDefEdit.CmdText = cmd.Text; ButtonDefEdit.CmdCommand = cmd.Command; ButtonDefEdit.CmdTemplate = cmd.Template; ButtonDefEdit.CmdToolTip = toolTip.GetToolTip(cmd); cmd.BackColor = Color.FromKnownColor(KnownColor.ActiveCaption); if (ButtonDefEdit.ShowDialog() == DialogResult.OK) { cmd.BackColor = Color.FromKnownColor(KnownColor.Control); cmd.UseVisualStyleBackColor = true; cmd.Focus(); cmd.Text = ButtonDefEdit.CmdText; cmd.Command = ButtonDefEdit.CmdCommand; SetTextCommand(cmd); cmd.Template = ButtonDefEdit.CmdTemplate; toolTip.SetToolTip(cmd, ButtonDefEdit.CmdToolTip); if (string.IsNullOrEmpty(cmd.Command)) cmd.Command = cmd.Text; } else { CancelCmdEdit(); } } }
internal CommandEx FindCommandEx(CmdButton cmd) { foreach (CommandEx cx in CommandsEx) if (cx.Name == cmd.Name) return cx; return null; }