?? 新建 文本文檔.txt
字號:
//上移下移代碼
if (tabList.SelectedIndex != -1)
{
int delta;
//因為標簽排序號是1,3,5,7,9方式排列的
//將一個標簽的上移或下移一位,就把標簽序號加減3,正好為一偶數就在前后一位的前面或后面。
//如:將第7位上移,那么新的順序是1,3,4,5,9
if (cmd == "down")
{
delta = 3;
}
else
{
delta = -3;
}
TabItem t;
t = (TabItem) portalTabs[tabList.SelectedIndex];
t.TabOrder += delta;
// 重新排序構造新的排序號
OrderTabs();
}
/// <summary>
/// 將portalTabs中的標簽排序
/// </summary>
private void OrderTabs ()
{
int i = 1;
// 使用指定的比較器對部分 System.Collections.ArrayList 中的元素進行排序。
// portalTabs中的對象是TabItem,TabItem對象繼承了IComparable接口,實現了以TabOrder的CompareTo
portalTabs.Sort();
// renumber the order and save to database
// 將排序后的信息存入XML
foreach (TabItem t in portalTabs)
{
// 將標簽的排序號按1, 3, 5,遞增的順序排列
t.TabOrder = i;
i += 2;
// 將新的排序號寫入用戶配置文件
Configuration config = new Configuration();
config.UpdateTabOrder(t.TabId, t.TabOrder);
}
}
public void SaveSiteSettings()
{
// 原來的:從Cache中獲取站點設置信息數據集(好像是個Bug,因為每次更新數據是更新的HttpContext.Current.Items中的)
//SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Cache["SiteSettings"];
// 修改后的
SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Items["SiteSettings"];
// 如果Cache中沒有,則重新構建
if(siteSettings == null)
{
// If SaveSiteSettings() is called once, the cache is cleared. If it is
// then called again before Global.Application_BeginRequest is called,
// which reloads the cache, the siteSettings object will be Null
// (這一句不知翻譯的對不對,好像很重要)如果SaveSiteSettings()被調用過一次后,Cache就回被清除。如果它再一次被調用在Global.Application_BeginRequest前siteSettings為null則重新寫Cache
siteSettings = GetSiteSettings();
}
string configFile = HttpContext.Current.Server.MapPath(ConfigurationSettings.AppSettings["configFile"]);
// Object is evicted from the Cache here.
// 將變更后的數據集寫入到Xml文件
siteSettings.WriteXml(configFile);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -