当我在加载数据的时候,
我该如何控制进度条
- C# code
private void RefreshWindow(StorageLocation enumOP) { //这个函数是执行复杂的串口通讯 得到的一个list 结果, 如何在这里 添加一个进度条啊? this.list = this.currentSC.GetAllInformation(); // 绑定数据到 datagrid 中 this.Select(enumOP, string.Empty); }
------解决方案--------------------
在 this.currentSC 中设计一个事件,以及公开一个 完成进度(百分比) 的属性,
如
- C# code
public class SC{ public double Finished{get;private set;} public event EventHandler Advanced ; // 或者把进度包含在里面也可以,如 // public event EventHandler<double> Advanced ; }