예제 #1
0
 private static string Execute(string processName, 
     IEnumerable<string> commands, 
     Func<IObservable<string>, IDisposable> outputFeedSubscribeAction,
     Action<IObserver<string>> processAttachAction)
 {
     return CommandPromptRunner.Run(processName, commands.Concat("exit").ToObservable(), IsConsole(), outputFeedSubscribeAction, processAttachAction);
 }
예제 #2
0
        public void StartCmdPromptProcess(string processName)
        {
            var subject = new Subject <string>();

            m_observer = subject;
            var syncContext = SynchronizationContext.Current;

            Task.Factory.StartNew(() =>
            {
                CommandPromptRunner.Run
                (
                    processName,
                    subject,
                    outputFeedSubscribeAction: o => o.Buffer(TimeSpan.FromMilliseconds(50), 10).ObserveOn(syncContext)
                    .Subscribe(Observer.Create <IList <string> >(x => richTextBox1.AppendText(string.Join(string.Empty, x))))
                );
            });
        }