?? apppagecounter.cs
字號:
using System;
using System.Web;
namespace book06
{
/// <summary>
/// AppPageCounter 的摘要說明。
/// </summary>
public class AppPageCounter : IPageCounter
{
public AppPageCounter()
{
if (HttpContext.Current.Application["PageCount"] == null)
{
HttpContext.Current.Application.Add("PageCount", 0);
}
}
#region IPageCounter 成員
public int GetPageCount()
{
return (int)HttpContext.Current.Application["PageCount"];
}
public void SetPageCount(int iCount)
{
HttpContext.Current.Application.Lock();
if (HttpContext.Current.Application["PageCount"] == null)
{
HttpContext.Current.Application.Add("PageCount", 0);
}
else
{
HttpContext.Current.Application["PageCount"] = iCount;
}
HttpContext.Current.Application.UnLock();
}
public void IncreasePageCount()
{
HttpContext.Current.Application.Lock();
HttpContext.Current.Application["PageCount"] = GetPageCount() + 1;
HttpContext.Current.Application.UnLock();
}
#endregion
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -