예제 #1
0
        void Execute(string cmdPath, string cmdExe, string cmdArgs, string title, int delay)
        {
            ConsoleData data = new ConsoleData(cmdPath, cmdExe, cmdArgs, title, delay, new ServicePanel(maxConsoleLines), new Process());

            CreateTabPageDelegate d = new CreateTabPageDelegate(CreateTabPage);
            Invoke(d, new object[] { data });
            btnStart_Click(data.panel.btnStart, new EventArgs());
        }
예제 #2
0
 void SetConsoleState(ConsoleData data, bool Enable)
 {
     try
     {
         Invoke(new MethodInvoker(delegate {
             data.tab.ImageIndex = Enable ? 1 : 0;
             data.panel.btnStart.Enabled = !Enable;
             data.panel.btnSendCtrlC.Enabled = Enable;
         }));
     }
     catch (ObjectDisposedException)
     {
         // ignore this, it only happens when closing the app
     }
     catch (InvalidOperationException)
     {
         // ignore this, it only happens when closing the app
     }
 }
예제 #3
0
        private void CreateTabPage(ConsoleData data)
        {
            DockingTabPage tab = new DockingTabPage(data.title);
            tab.ContextMenuStrip = contextMenuStrip2;
            tabControl1.ImageList = imageList1;
            tab.Controls.Add(data.panel);
            tab.ImageIndex = 0;
            tab.Tag = data;
            data.panel.Dock = DockStyle.Fill;
            tabControl1.TabPages.Add(tab);
            data.tab = tab;
            data.panel.btnStart.Click += new System.EventHandler(this.btnStart_Click);
            data.panel.btnStart.Tag = data;
            if (System.IO.File.Exists(CtrlCHelperPath))
            {
                data.panel.btnSendCtrlC.Enabled = true;
                data.panel.btnSendCtrlC.Visible = true;
                data.panel.btnSendCtrlC.Click += new System.EventHandler(this.btnSendCtrlC_Click);
                data.panel.btnSendCtrlC.Tag = data;
            }
            else
            {
                data.panel.btnSendCtrlC.Enabled = false;
                data.panel.btnSendCtrlC.Visible = false;
            }

            data.panel.btnKill.Click += new System.EventHandler(this.btnKill_Click);
            data.panel.btnKill.Text = "Kill all " + data.title + "instances";
            data.panel.btnKill.Tag = data;

            data.panel.btnClear.Click += new System.EventHandler(this.btnClear_Click);
            data.panel.btnClear.Tag = data;

            dicPanel[tab] = data.panel;
        }