コード例 #1
0
 public void Output(string str)
 {
     OutText.Text += str + "\r\n";
     OutText.Select(OutText.TextLength, 0);
     OutText.ScrollToCaret();
     OutText.Invalidate();
 }
コード例 #2
0
ファイル: ClientForm.cs プロジェクト: niha31/SimpleServer
 public void UpdateChatWindow(String message)
 {
     if (OutText.InvokeRequired)
     {
         Invoke(_updateChatWindowDelgate, message);
     }
     else
     {
         OutText.Text          += message + "\n";
         OutText.SelectionStart = OutText.Text.Length;
         OutText.ScrollToCaret();
     }
 }
コード例 #3
0
        private void ExecuteButton_Click(object sender, EventArgs e)
        {
            StartAnimation();

            try
            {
                Process process = new Process();

                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardOutput = process.StartInfo.RedirectStandardError = true;
                process.StartInfo.FileName       = _Program;
                process.StartInfo.Arguments      = GetCommand();
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                process.StartInfo.CreateNoWindow = true;
                process.Start();

                string output = process.StandardOutput.ReadToEnd();
                string error  = process.StandardError.ReadToEnd();

                OutText.Text += Environment.NewLine;

                if (output != Environment.NewLine)
                {
                    OutText.Text += output;
                }

                if (!string.IsNullOrEmpty(error))
                {
                    OutText.Text += error;
                }

                process.WaitForExit();
            }
            catch (Exception ex)
            {
                OutText.Text += ex.ToString();
            }

            OutText.SelectionStart = OutText.Text.Length;
            OutText.ScrollToCaret();

            StopAnimation();
        }