如何从for循环中执行某些序列的不同类更新单个ui。 [英] how to update a single ui from different class executing some sequences in a for loop.
问题描述
I 有 一个 单  UI 和  I  AM 执行 一些 序列 在 一个 对于 环路NBSP;  在 一个 不同 类 档案。我 需要 到 更新 
ui 对于     发送 文本 和   更新 进度 吧。
                
for(int i = 0; i< = dtSteps.Rows.Count - 1; i ++)
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {
$
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; lblProgress.Text =" Executing Step" +(i + 1)+"的" + dtSteps.Rows.Count;
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; lblProgress.Update();
//基于 在&NBSP;一些&NBSP; condition
Textbar.text =" some instruction;"
Textbar.update()
&NBSP; SecondProgressBar.Value = Convert.ToInt32(Math.Round(((double)(i + 1)/(dtSteps.Rows.Count))* 100,0));
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; Thread.Sleep(300);
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }
I have a single ui and i am executing some sequence in a for loop in a different class file .I need to update ui for sending text and updating progress bar.
for (int i = 0; i <= dtSteps.Rows.Count - 1; i++)
{
lblProgress.Text = "Executing Step " + (i + 1) + " of" + dtSteps.Rows.Count;
lblProgress.Update();
//based on some condition
Textbar.text="some instruction;"
Textbar.update()
SecondProgressBar.Value = Convert.ToInt32(Math.Round(((double)(i + 1) / (dtSteps.Rows.Count)) * 100, 0));
Thread.Sleep(300);
}
这篇关于如何从for循环中执行某些序列的不同类更新单个ui。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!