asp.net开发WAP网站及集成在线wap模拟器(5)
ParamRules实现如下: Code [http://www.xueit.com] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Rsion.Web{ /// summary ///
ParamRules实现如下:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Rsion.Web { /// <summary> /// 模板参数规则类 /// </summary> public class ParamRules:IEnumerable { private Dictionary<string, object> rules; public ParamRules() { if (rules == null) rules = new Dictionary<string, object>(); } public object this[string paramKey] { get { if (rules.ContainsKey(paramKey)) return rules[paramKey]; return ""; } set { if (rules.ContainsKey(paramKey)) rules[paramKey] = value; else rules.Add(paramKey, value); } } /// <summary> /// 添加新的规则 /// </summary> /// <param name="paramKey"></param> /// <param name="paramValue"></param> public void Add(string paramKey, object paramValue) { if (rules.ContainsKey(paramKey)) throw new ArgumentException("对不起规则已经存在!Key:" paramKey ",Value:" rules[paramKey].ToString(), "paramKey"); rules.Add(paramKey, paramValue); } public void Remove(string paramKey, object paramValue) { if (rules.ContainsKey(paramKey)) rules.Remove(paramKey); } #region IEnumerable 成员 public IEnumerator GetEnumerator() { foreach (KeyValuePair<string, object> k in rules) { yield return k; } } #endregion } }
Template.cs实现如下:

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Rsion.Web { /// <summary> /// 模板 /// </summary> public class Template { public static Template _template; private static ParamRules rules; private Template() { } public static Template CreateInstance() { if (_template == null) _template = new Template(); return _template; } public ParamRules Rules { get { if (rules == null) rules = new ParamRules(); return rules; } } } }
这样我们先在global.asax中填加一些模板数据,这样才可以解析模板,解析模板的功能实现在PageAdapter中,这样可以
在本页面直接调用Html.RenderPartial("template")调用
精彩图集
精彩文章
热门标签
adb命令大全
gcc编译c
小球完全
图文安装
垃圾文件
设置壁纸
getline()
stripslashes
源到单一格
本地安卓
秘钥
dom4j解析xml文件
php php使用
报404错误
3元1次
数据库目录
slider
JS操作JSON
中文换行
fdisk
hex
ja
JS函数
反序列化
续传
行记录
sqlserve
js表格
创建链表
绑定类型
日志系统
ModelDriven
之堆
thinkphp控制器
android图片上传
指定类型文件
条形码生成器
中文长度
js调用
base标签
mp3下载
norflash接口
新浪
支持多少个线
目录配置
php php操作Exc
sql查询语句
无锁队列
php php代码
socket套接字
元组
数组最大值
当前时区
数据字典
java格式化数值
特定类别
des加密解密
有限状态机
mysql_field_
自动高亮
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229