Click here to Skip to main content
15,893,161 members
Home / Discussions / C#
   

C#

 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:08
professionalKeith Barrow26-Dec-10 7:08 
Questionmodify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 7:19
abbd26-Dec-10 7:19 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:27
professionalKeith Barrow26-Dec-10 7:27 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 7:30
abbd26-Dec-10 7:30 
AnswerRe: modify XmlDictionaryReaderQuotas Pin
Keith Barrow26-Dec-10 7:59
professionalKeith Barrow26-Dec-10 7:59 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 8:04
abbd26-Dec-10 8:04 
QuestionRe: modify XmlDictionaryReaderQuotas Pin
abbd26-Dec-10 23:18
abbd26-Dec-10 23:18 
QuestionRedirecting standard output of an application Pin
TcachTcachTcach25-Dec-10 21:36
TcachTcachTcach25-Dec-10 21:36 
Hi!

I have a native win32 console application and it gives some outputs. I want to redirect its output(error out too) to my WPF app in real-time (asynchronously), I use this code, but all I have - result after the process is finished!

private void button2_Click(object sender, RoutedEventArgs e)
    {
      Process sortProcess;
      sortProcess = new Process();
      sortProcess.StartInfo.FileName = textBox1.Text;      
      sortProcess.StartInfo.UseShellExecute = false;
      sortProcess.StartInfo.RedirectStandardOutput = true;
      sortOutput = new StringBuilder("");      
      sortProcess.OutputDataReceived += new DataReceivedEventHandler(SortOutputHandler);      
      sortProcess.StartInfo.RedirectStandardInput = true;      
      sortProcess.Start();
      sortProcess.BeginOutputReadLine();
      //sortProcess.WaitForExit();
      sortProcess.Close();      
      
    }

    private void SortOutputHandler(object sendingProcess,
      DataReceivedEventArgs outLine)
    {
      // Collect the sort command output.
      if (!String.IsNullOrEmpty(outLine.Data))
      {
        textBox2.Dispatcher.BeginInvoke(DispatcherPriority.Input, (Action)delegate()
        {
          textBox2.Text += outLine.Data + Environment.NewLine;
        });
      }


Any ideas?

Thanks!
AnswerRe: Redirecting standard output of an application Pin
Abhinav S25-Dec-10 23:18
Abhinav S25-Dec-10 23:18 
GeneralRe: Redirecting standard output of an application Pin
TcachTcachTcach26-Dec-10 0:26
TcachTcachTcach26-Dec-10 0:26 
AnswerRe: Redirecting standard output of an application Pin
Luc Pattyn26-Dec-10 1:57
sitebuilderLuc Pattyn26-Dec-10 1:57 
GeneralRe: Redirecting standard output of an application Pin
TcachTcachTcach26-Dec-10 2:32
TcachTcachTcach26-Dec-10 2:32 
AnswerRe: Redirecting standard output of an application Pin
Luc Pattyn26-Dec-10 3:02
sitebuilderLuc Pattyn26-Dec-10 3:02 
GeneralRe: Redirecting standard output of an application Pin
TcachTcachTcach26-Dec-10 3:47
TcachTcachTcach26-Dec-10 3:47 
GeneralRe: Redirecting standard output of an application Pin
Luc Pattyn26-Dec-10 3:55
sitebuilderLuc Pattyn26-Dec-10 3:55 
AnswerRe: Redirecting standard output of an application Pin
PIEBALDconsult26-Dec-10 4:56
mvePIEBALDconsult26-Dec-10 4:56 
GeneralRe: Redirecting standard output of an application Pin
TcachTcachTcach27-Dec-10 23:12
TcachTcachTcach27-Dec-10 23:12 
QuestionWeak reference and garbage collection Pin
thomus0724-Dec-10 22:24
thomus0724-Dec-10 22:24 
AnswerRe: Weak reference and garbage collection Pin
#realJSOP25-Dec-10 0:35
mve#realJSOP25-Dec-10 0:35 
AnswerRe: Weak reference and garbage collection Pin
SledgeHammer0125-Dec-10 7:27
SledgeHammer0125-Dec-10 7:27 
GeneralRe: Weak reference and garbage collection Pin
thomus0725-Dec-10 19:03
thomus0725-Dec-10 19:03 
AnswerRe: Weak reference and garbage collection Pin
Pete O'Hanlon25-Dec-10 8:41
mvePete O'Hanlon25-Dec-10 8:41 
GeneralRe: Weak reference and garbage collection Pin
thomus0725-Dec-10 19:06
thomus0725-Dec-10 19:06 
AnswerRe: Weak reference and garbage collection Pin
_Erik_27-Dec-10 2:46
_Erik_27-Dec-10 2:46 
AnswerRe: Weak reference and garbage collection Pin
jschell27-Dec-10 8:12
jschell27-Dec-10 8:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.