Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public CommandEx(CmdButton cmd, string toolTip)
 {
     if (cmd != null)
     {
         Name = cmd.Name;
         Command = cmd.Command;
         Text = cmd.Text;
         ToolTip = toolTip;
         Template = cmd.Template;
     }
 }
Ejemplo n.º 3
0
 public CommandEx(CmdButton cmd, string toolTip)
 {
     if (cmd != null)
     {
         Name     = cmd.Name;
         Command  = cmd.Command;
         Text     = cmd.Text;
         ToolTip  = toolTip;
         Template = cmd.Template;
     }
 }
Ejemplo n.º 4
0
 internal CommandEx FindCommandEx(CmdButton cmd)
 {
     foreach (CommandEx cx in CommandsEx)
     {
         if (cx.Name == cmd.Name)
         {
             return(cx);
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 private void SetTextCommand(CmdButton cmd)
 {
     if (string.IsNullOrEmpty(cmd.Command))
         cmd.Command = cmd.Text;
     else if (string.IsNullOrEmpty(cmd.Text))
         cmd.Text = cmd.Command;
 }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        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();
                }

            }
        }
Ejemplo n.º 9
0
 internal CommandEx FindCommandEx(CmdButton cmd)
 {
     foreach (CommandEx cx in CommandsEx)
         if (cx.Name == cmd.Name)
             return cx;
     return null;
 }