public MainWindow() { InitializeComponent(); //3.将相应函数注册到委托事件中 ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); ExitHandler += new ExitDelegate(ExitAction); button1.Content = "生成excel数据"; InitMenus(); }
private void Form1_Load(object sender, EventArgs e) { //this.xml(); ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); form1 = this; this.init(); this.statusBarEvent(); ThreadPool.RegisterWaitForSingleObject(new AutoResetEvent(true), new WaitOrTimerCallback(findServiceStatus), null, 100, false); ThreadPool.RegisterWaitForSingleObject(new AutoResetEvent(true), new WaitOrTimerCallback(processInfo), null, 1000, false); // ThreadPool.RegisterWaitForSingleObject(new AutoResetEvent(true), new WaitOrTimerCallback(getWindowsErrorLog), null, 1000, false); this.load_apache_web(); this.load_mysql_list(); this.getWindowsErrorLog(); }
public UCExecuteSQL() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); this.textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("TSQL"); try { this.textEditorControl1.LoadFile(GobalParameters.UpdateSqlFilePath); } catch (Exception) { } // // TODO: Add constructor code after the InitializeComponent() call. // }
private void Init() { //3.将相应函数注册到委托事件中 ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); CmdProcess = new Process(); CmdProcess.StartInfo.CreateNoWindow = true; // 不创建新窗口 CmdProcess.StartInfo.UseShellExecute = false; CmdProcess.StartInfo.RedirectStandardInput = true; // 重定向输入 CmdProcess.StartInfo.RedirectStandardOutput = true; // 重定向标准输出 CmdProcess.StartInfo.RedirectStandardError = true; // 重定向错误输出 //CmdProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; CmdProcess.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived); CmdProcess.ErrorDataReceived += new DataReceivedEventHandler(p_ErrorDataReceived); CmdProcess.EnableRaisingEvents = true; // 启用Exited事件 CmdProcess.Exited += new EventHandler(CmdProcess_Exited); // 注册进程结束事件 this.suggestion = new Suggestion(Application.StartupPath + "\\qcmd.ini", "qcmd"); }
//以下为实现异步输出CMD信息 private void Init() { //3.将相应函数注册到委托事件中 ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); }
private void Init() { ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); ProcessExit += new DelProcessExit(CmdProcess_Exited); }
public Form1() { InitializeComponent(); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); }
private void Form1_Load(object sender, EventArgs e) { //3.将相应函数注册到委托事件中 ReadStdOutput += new DelReadStdOutput(ReadStdOutputAction); ReadErrOutput += new DelReadErrOutput(ReadErrOutputAction); }