c# - Update gui from Process (on other thread) using async -
the method process.beginoutputreadline() reads output asynchronously on thread other gui's thread. trying find way use async , await in c# code.
p = new process(); p.startinfo.useshellexecute = false; p.startinfo.createnowindow = true; p.startinfo.redirectstandardoutput = true; p.startinfo.filename = "mplayer.exe"; p.startinfo.arguments = @"c:\movie.mp4"; p.outputdatareceived += p_outputdatareceived; p.start();
is there way update using async method in process class?
not asynchronous methods in .net can used async , await. on there years there have been different async patterns introduced framework. different portions of framework have been implemented using different patterns. have here description of different patterns: https://msdn.microsoft.com/en-us/library/jj152938(v=vs.110).aspx
in case, interface implemented event-based asynchronous pattern (eap) since there event handler , method initiate.
there article here: https://msdn.microsoft.com/en-us/library/hh873178(v=vs.110).aspx discusses interop between async patterns , discusses you're looking for.
however, don't need that, can use p.standardoutput.readasync
awaitable method read same output stream outputdatareceived
read.
Comments
Post a Comment