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实现如下:
Code [http://www.xueit.com]
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实现如下:
Code [http://www.xueit.com]
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")调用
精彩图集
精彩文章
热门标签
移动网络数据
元素拖动
新浪微博api
Linux用户管理
nowdoc
logging
date命令
mysql字符串
相同后缀
国家气象局
无环图
高级编程
枚举
当前
CD-KEY
拿来
配置jdk
开发工具
层次查询
未读
大小写敏感
R3
java反序列化
空行
分割文件
PHP分词
保护硬盘
拼合生成器
统计总行数
创建视图
windows误删
php 将字
游戏
透明窗体
聊天命令
self
android网络编程
照片伸缩
文件大小
excel生成报表
UbuntuSamba
触发表
二进制流
HTML表单
语法特性
超实
Prim算法
导航问题
NGEN
两行字符
AjaxFileUplo
XHTML
运行机制
前导0
setInterval
标签
301
D3.js
另一
Mempodipper本
赞助商链接
@CopyRight 2002-2008, 1SOHU.COM, Inc. All Rights Reserved QQ:1010969229

