如何在列表框中显示执行的进度 [英] how to show the progress of Execution in list Box

查看:105
本文介绍了如何在列表框中显示执行的进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi



i我正在使用这种方法阅读文件



hi

i am reading a file with this method

string result;
ProcessStartInfo start = new ProcessStartInfo();
var rootOfCurrentPath = Path.GetPathRoot(Environment.CurrentDirectory) + "Python25" + "\\Python.exe";
start.FileName = rootOfCurrentPath;
start.Arguments = (Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + "TA" + "\\" + "Tool" + "\\" + "demo" + ".py");
start.ErrorDialog = false;
start.UseShellExecute = false;
start.RedirectStandardError = true;
start.RedirectStandardInput = true;
start.RedirectStandardOutput = true;
start.CreateNoWindow = true;
StreamReader reader = null;
listLog.Items.Clear();
string strlog = "";
BackgroundWorker worker = new BackgroundWorker();
worker.WorkerSupportsCancellation = true;
worker.WorkerReportsProgress = true;


// reading the file
using (Process process = Process.Start(start))
{
    using (reader = process.StandardOutput)
    {
        while ((result = reader.ReadLine()) != null)
        listLog.Items.Add(result);
     
    }
   
        
}



并将值添加到列表框但是当它发生时complet阅读完成

i想要同时阅读并在列表框中显示请帮帮我。


and adding the value to the List box but it is happening when complet reading is done
i want to simultaneously read and display in the list box please help me on this.

推荐答案

看看这个关于类似主题的codeproject文章入门 BackgroundWorker和ProgressBar演示 [ ^ ]
Have a look at this codeproject article on a similar subject to get started BackgroundWorker and ProgressBar demo[^]


这篇关于如何在列表框中显示执行的进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆