CodeSmith 使用教程(9): Progress对象
来源:互联网 发布:上海少年编程培训 编辑:程序博客网 时间:2024/05/16 05:15
使用Progress对象可以为CodeSmith生成代码的过程显示一个进度条,这对于生成比较费时的模板操作是非常有用的,如果你使用Visual Studio,可以在状态栏中显示一进度条:
使用进度条的方法是通过CodeTemplate对象的Progress属性对象,首先是设置Progress对象的最大值和步长,本例通过一个简单的循环来模拟一个费时的操作:
<%@ Template Language="C#" TargetLanguage="Text" Debug="False" %><%@ Import Namespace="System.Threading" %>This is a progress demo.<% SimulateProgress(); %><script runat="template">public void SimulateProgress(){Progress.MaximumValue = 25;Progress.Step = 1; for(int i=0;i<25;i++){ Progress.PerformStep(); Thread.Sleep(100); Response.WriteLine("step {0} ",i); }}</script>
让进度条前进一步是通过Progress对象的PerfStep方法来实现的。
本例下载
- CodeSmith 使用教程(9): Progress对象
- CodeSmith 使用教程(9): Progress对象
- CodeSmith 使用教程(8): CodeTemplate对象
- CodeSmith 使用教程(10): CodeTemplateInfo 对象
- CodeSmith 使用教程(8): CodeTemplate对象
- CodeSmith 使用教程(10): CodeTemplateInfo 对象
- codeSmith的使用教程
- CodeSmith使用教程
- CodeSmith 使用教程: 总结
- CodeSmith 使用教程: 总结
- CodeSmith 使用教程(1): 概述
- CodeSmith 使用教程(13) 调试
- CodeSmith 使用教程(1): 概述
- CodeSmith 使用教程(13) 调试
- CodeSmith 使用教程(16) 使用XMLProperty
- CodeSmith 使用教程(16) 使用XMLProperty
- CodeSmith 教程
- CodeSmith教程
- 国外IT网站
- Android培训---使用支持类库
- Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(二)
- bash参考手册之三(基本的Shell特性)续一
- 深入浅出Javascript(三)创建自定义对象以及属性、方法
- CodeSmith 使用教程(9): Progress对象
- 在线头像制作网站FaceYourManga
- Dead Man's Island——5、A Dead Man
- Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(一)
- Android Recovery模式
- 常用Powerbuilder 的颜色列表
- CentOS 更改默认启动顺序
- 天气预报接口,备忘
- 在android中利用多线程实现对控件的更新(动态修改文本框中的值)。简述原理并上传代码。