Esempio n. 1
0
        public ClkActionUI(ClkAction action)
        {
            InitializeComponent();
            m_tt           = new ToolTip();
            Action         = new ClkAction(action);
            FocusedEditbox = m_edit_exec;
            string tt;

            // Executable
            tt = "The program or batch file to execute";
            m_lbl_exec.ToolTip(m_tt, tt);
            m_edit_exec.ToolTip(m_tt, tt);
            m_edit_exec.Text      = Action.Executable;
            m_edit_exec.GotFocus += (s, a) =>
            {
                FocusedEditbox = m_edit_exec;
            };
            m_edit_exec.TextChanged += (s, a) =>
            {
                Action.Executable = m_edit_exec.Text;
                UpdateUI();
            };

            // Arguments
            tt = "The arguments to pass to the executable.\r\n" +
                 "For sub string or wildcard patterns use {0} to represent the matched text.\r\n" +
                 "For regular expressions use {0},{1},{2},... to represent capture groups";
            m_lbl_args.ToolTip(m_tt, tt);
            m_edit_args.ToolTip(m_tt, tt);
            m_edit_args.Text      = Action.Arguments;
            m_edit_args.GotFocus += (s, a) =>
            {
                FocusedEditbox = m_edit_args;
            };
            m_edit_args.TextChanged += (s, a) =>
            {
                Action.Arguments = m_edit_args.Text;
                UpdateUI();
            };

            // Start in directory
            tt = "The working directory to start the executable in";
            m_lbl_startin.ToolTip(m_tt, tt);
            m_edit_startin.ToolTip(m_tt, tt);
            m_edit_startin.Text      = Action.WorkingDirectory;
            m_edit_startin.GotFocus += (s, a) =>
            {
                FocusedEditbox = m_edit_startin;
            };
            m_edit_startin.TextChanged += (s, a) =>
            {
                Action.WorkingDirectory = m_edit_startin.Text;
                UpdateUI();
            };

            // Browse button
            m_btn_browse.ToolTip(m_tt, "Browse for an executable to run");
            m_btn_browse.Click += (s, a) =>
            {
                var dg = new OpenFileDialog {
                    Title = "Select an Executable", CheckPathExists = true, Filter = Constants.ExecutablesFilter
                };
                if (dg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                m_edit_exec.Text = dg.FileName;
                UpdateUI();
            };

            // Capture groups button
            m_btn_capture_groups.ToolTip(m_tt, "Displays a menu of the pattern match tags and special tags");
            m_btn_capture_groups.Click += (s, a) =>
            {
                ShowCaptureGroupsMenu();
                UpdateUI();
            };

            Disposed += (s, a) =>
            {
                m_tt.Dispose();
            };

            UpdateUI();
        }
Esempio n. 2
0
 public ClkAction(ClkAction rhs) : base(rhs)
 {
     Executable       = rhs.Executable;
     Arguments        = rhs.Arguments;
     WorkingDirectory = rhs.WorkingDirectory;
 }