本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.RestoreTab方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.RestoreTab方法的具体用法?C# TabController.RestoreTab怎么用?C# TabController.RestoreTab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Tabs.TabController
的用法示例。
在下文中一共展示了TabController.RestoreTab方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreTab
private bool RestoreTab(TabInfo tab)
{
var success = true;
if (tab != null)
{
if (!Null.IsNull(tab.ParentId) && DeletedTabs.Any(t => t.TabID == tab.ParentId))
{
Skin.AddModuleMessage(this,
string.Format(Localization.GetString("ChildTab.ErrorMessage", LocalResourceFile), tab.TabName),
ModuleMessage.ModuleMessageType.YellowWarning);
success = false;
}
else
{
var tabController = new TabController();
tabController.RestoreTab(tab, PortalSettings);
DeletedTabs.Remove(tab);
//restore modules in this tab
modulesListBox.Items.Cast<ListItem>().ToList().ForEach(i =>
{
var values = i.Value.Split('-');
var tabId = int.Parse(values[0]);
var moduleId = int.Parse(values[1]);
if(tabId == tab.TabID)
{
RestoreModule(moduleId, tabId);
}
});
}
}
return success;
}
示例2: enabledCheckbox_CheckChanged
protected void enabledCheckbox_CheckChanged(object sender, EventArgs e)
{
try
{
if ((sender) is DnnCheckBox)
{
var enabledCheckbox = (DnnCheckBox) sender;
int languageId = int.Parse(enabledCheckbox.CommandArgument);
Locale locale = LocaleController.Instance.GetLocale(languageId);
Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId);
Dictionary<string, Locale> enabledLanguages = LocaleController.Instance.GetLocales(PortalId);
var tabController = new TabController();
var localizedTabs = PortalSettings.ContentLocalizationEnabled ?
tabController.GetTabsByPortal(PortalId).WithCulture(locale.Code, false).AsList() : new List<TabInfo>();
var redirectUrl = string.Empty;
if (enabledCheckbox.Enabled)
{
// do not touch default language
if (enabledCheckbox.Checked)
{
if (!enabledLanguages.ContainsKey(locale.Code))
{
//Add language to portal
Localization.AddLanguageToPortal(PortalId, languageId, true);
}
//restore the tabs and modules
var moduleController = new ModuleController();
foreach (var tab in localizedTabs)
{
tabController.RestoreTab(tab, PortalSettings);
moduleController.GetTabModules(tab.TabID).Values.ToList().ForEach(moduleController.RestoreModule);
}
}
else
{
//remove language from portal
Localization.RemoveLanguageFromPortal(PortalId, languageId);
//if the disable language is current language, should redirect to default language.
if(locale.Code.Equals(Thread.CurrentThread.CurrentUICulture.ToString(), StringComparison.InvariantCultureIgnoreCase))
{
redirectUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID,
PortalSettings.ActiveTab.IsSuperTab,
PortalSettings, "", defaultLocale.Code);
}
//delete the tabs in this language
foreach (var tab in localizedTabs)
{
tab.DefaultLanguageGuid = Guid.Empty;
tabController.SoftDeleteTab(tab.TabID, PortalSettings);
}
}
}
//Redirect to refresh page (and skinobjects)
if (string.IsNullOrEmpty(redirectUrl))
{
redirectUrl = Globals.NavigateURL();
}
Response.Redirect(redirectUrl, true);
}
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException(this, ex);
}
}