Progress对象可以在CodeSmith生成代码时给用户显示一个进度条,当生成代码的时间很长时非常有用。如果你使用的是CodeSmith Explorer,进度条将显示在Generate按钮的左边:

如果使用的是CodeSmith Studio,进度条将显示在状态栏上:

CodeSmith实用技巧(十四):使用Progress对象

使用Progress和在WinForm中使用进度条差不多,需要设置它的最大值和步长:

CodeSmith实用技巧(十四):使用Progress对象this.Progress.MaximumValue = 25;
CodeSmith实用技巧(十四):使用Progress对象
this.Progress.Step = 1;

如果想显示出进度,需要调用PerformStep方法:

CodeSmith实用技巧(十四):使用Progress对象this.Progress.PerformStep();

相关文章:

  • 2021-05-06
  • 2021-05-20
  • 2021-09-20
  • 2022-12-23
猜你喜欢
  • 2021-06-18
  • 2021-06-26
  • 2021-12-15
相关资源
相似解决方案