本文整理汇总了C#中Umbraco.Core.UmbracoApplicationBase类的典型用法代码示例。如果您正苦于以下问题:C# UmbracoApplicationBase类的具体用法?C# UmbracoApplicationBase怎么用?C# UmbracoApplicationBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UmbracoApplicationBase类属于Umbraco.Core命名空间,在下文中一共展示了UmbracoApplicationBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
var db = applicationContext.DatabaseContext.Database;
//Database versioning and upgrade
//Determine which database version we are on
//Execute the appropriate method to upgrade
if (!db.TableExist("ContactMessage") && !db.TableExist("ContactSettings"))
{
//There is no database. Do the initial creation
CreateDataBase(db);
}
if (db.TableExist("ContactMessage") && db.TableExist("ContactSettings") && !db.TableExist("uContactorVersion"))
{
//Database is version 0. Upgrade to version 1.
Upgrade00to01(db);
}
installer = new LanguageInstaller();
installer.CheckAndInstallLanguageActions();
var us = applicationContext.Services.UserService;
var user = us.GetByProviderKey(0);
if (!user.AllowedSections.Any(x => x == "uContactor"))
{
user.AddAllowedSection("uContactor");
us.Save(user);
}
}
示例2: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
global::Umbraco.Web.UI.JavaScript.ServerVariablesParser.Parsing += (sender, dictionary) =>
{
dictionary["paramsEditorResourceUrl"] = "/umbraco/api/params/";
};
}
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:7,代码来源:Unico.Etechno.Catalog.ParamsController.cs
示例3: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
MemberService.Saved += MemberService_Saved;
MemberService.Created += MemberService_Created;
MemberService.Deleting += MemberService_Deleting;
}
示例4: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
if (CriteriaConfigHelpers.IsCriteriaInUse(NumberOfVisitsPersonalisationGroupCriteria.CriteriaAlias))
{
UmbracoApplicationBase.ApplicationInit += ApplicationInit;
}
}
示例5: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Published += ContentService_Published;
// Map routes for all Box urls in each site
if (UmbracoContext.Current != null)
{
var allBoxes = UmbracoContext.Current.ContentCache.GetAtRoot().DescendantsOrSelf("Box");
if (allBoxes.Any())
{
foreach (var box in allBoxes)
{
var langIso = box.GetCulture().ThreeLetterISOLanguageName;
RouteTable.Routes.MapUmbracoRoute(
langIso + "MarketToBox",
box.UrlName + "/{slug}",
new
{
controller = "Fruits",
action = "Fruit",
slug = UrlParameter.Optional
},
new FruitsRouteHandler(MarketLibraryNodeId));
}
}
}
}
示例6: OnApplicationStarting
/// <summary>
/// Executes before resolution is frozen so that you are able to modify any plugin resolvers
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
if (USiteBuilderConfiguration.EnableDefaultControllerType)
{
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(TemplateBaseController));
}
}
示例7: OnApplicationStarting
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
var treeService = ApplicationContext.Current.Services.ApplicationTreeService;
// Hide default Umbraco Forms folder, we use our own to display folders
var umbFormTree = treeService.GetByAlias("form");
if (umbFormTree != null && umbFormTree.Initialize)
{
umbFormTree.Initialize = false;
treeService.SaveTree(umbFormTree);
}
// Add our own tree if it's not there yet
var pplxFormTree = treeService.GetByAlias("perplexForms");
if (pplxFormTree == null)
{
treeService.MakeNew(true, 1, "forms", "perplexForms", "Forms", "icon-folder", "icon-folder-open", "PerplexUmbraco.Forms.Controllers.PerplexFormTreeController, Perplex.Umbraco.Forms");
}
FormStorage.Created += FormStorage_Created;
FormStorage.Deleted += FormStorage_Deleted;
// Create perplexUmbracoUser for storage of Forms start nodes
// if it does not exist already. There seem to be some issues with SqlServer CE,
// it does not support some statements in this query.
// Those will be fixed later, for now we continue
try { Sql.ExecuteSql(PerplexUmbraco.Forms.Code.Constants.SQL_CREATE_PERPLEX_USER_TABLE_IF_NOT_EXISTS); }
catch (Exception) { }
}
示例8: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,
ApplicationContext applicationContext)
{
AddPluginSectionToDevelopersDashboard();
ContentService.Published += ContentService_Published;
}
示例9: OnApplicationStarting
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
if (InternalHelpers.MvcRenderMode)
{
ContentFinderResolver.Current.InsertTypeBefore<ContentFinderByPageIdQuery, CatalogContentFinder>();
}
}
示例10: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
var builder = new ContainerBuilder();
//register umbracocontext as a factory
builder.Register(c => UmbracoContext.Current).AsSelf();
//add all the controllers from the assembly
builder.RegisterControllers(System.Reflection.Assembly.GetExecutingAssembly());
//getting null pointer exception in the backend of umbraco if I don't load this one
builder.RegisterApiControllers(typeof(Umbraco.Web.Trees.ApplicationTreeController).Assembly);
//add custom class to the container as transient instance
builder.RegisterType<FriendService>().As<IFriendService>();
//se if we can just pass the instances to the builder, works and not needed cause of the umbracocontext, but gives us more control
builder.RegisterInstance(UmbracoContext.Current.Application.Services.ContentService);
builder.RegisterInstance(UmbracoContext.Current.Application.Services.MemberService);
builder.RegisterInstance(UmbracoContext.Current.Application.Services.RelationService);
builder.RegisterInstance(UmbracoContext.Current.Application.Services.MediaService);
builder.RegisterInstance(UmbracoContext.Current.Application.DatabaseContext.Database).As<Umbraco.Core.Persistence.Database>();
//register the myhelper class should be a interface etc.
builder.RegisterType<MyHelper>().As<IMyHelper>();
var container = builder.Build();
//setup the webapi dependency resolver to use autofac
System.Web.Mvc.DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
base.ApplicationStarted(umbracoApplication, applicationContext);
}
示例11: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
InvoiceService.StatusChanging += InvoiceService_StatusChanging;
InvoiceService.StatusChanged += InvoiceService_StatusChanged;
}
示例12: OnApplicationInitialized
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
MediaService.Saving += new TypedEventHandler<IMediaService, SaveEventArgs<IMedia>>(MediaService_Saving);
MediaService.Saved += new TypedEventHandler<IMediaService, SaveEventArgs<IMedia>>(MediaService_Saved);
MediaService.Deleted += new TypedEventHandler<IMediaService, DeleteEventArgs<IMedia>>(MediaService_Deleted);
MediaService.Trashed += new TypedEventHandler<IMediaService, MoveEventArgs<IMedia>>(MediaService_Trashed);
}
示例13: ApplicationStarted
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
base.ApplicationStarted(umbracoApplication, applicationContext);
MediaService.Saving += MediaService_Saving;
MediaService.Moved += MediaService_Moved;
}
示例14: ApplicationStarted
/// <summary>
/// Register Install & Uninstall Events
/// </summary>
/// <param name="umbracoApplication"></param>
/// <param name="applicationContext"></param>
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//Check to see if appSetting AnalyticsStartupInstalled is true or even present
var installAppSetting = WebConfigurationManager.AppSettings[AppSettingKey];
if (string.IsNullOrEmpty(installAppSetting) || installAppSetting != true.ToString())
{
var install = new InstallHelpers();
//Check to see if language keys for section needs to be added
install.AddTranslations();
//Check to see if section needs to be added
install.AddSection(applicationContext);
//Add Section Dashboard XML
install.AddSectionDashboard();
//All done installing our custom stuff
//As we only want this to run once - not every startup of Umbraco
var webConfig = WebConfigurationManager.OpenWebConfiguration("/");
webConfig.AppSettings.Settings.Add(AppSettingKey, true.ToString());
webConfig.Save();
}
//Add OLD Style Package Event
InstalledPackage.BeforeDelete += InstalledPackage_BeforeDelete;
//Add Tree Node Rendering Event - Used to check if user is admin to display settings node in tree
TreeControllerBase.TreeNodesRendering += TreeControllerBase_TreeNodesRendering;
}
示例15: ApplicationStarting
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//Events
ContentService.Created += Content_New;
ContentService.Saving += ContentService_Saving;
ContentService.Saved += ContentService_Saved;
ContentService.Published += Content_Published;
ContentService.UnPublished += Content_Unpublished;
ContentService.Moved += Content_Moved;
ContentService.Trashed += Content_Trashed;
ContentService.Deleted += Content_Deleted;
MediaService.Saved += Media_Saved;
//By registering this here we can make sure that if route hijacking doesn't find a controller it will use this controller.
//That way each page will always be routed through one of our controllers.
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(DefaultController));
//Remove the media picker property converters from the Umbraco Core Property Value Converters package.
//These will be replaced by custom converters.
PropertyValueConvertersResolver.Current.RemoveType<MediaPickerPropertyConverter>();
PropertyValueConvertersResolver.Current.RemoveType<MultipleMediaPickerPropertyConverter>();
//Add a web api handler. Here we can change the values from each web api call.
GlobalConfiguration.Configuration.MessageHandlers.Add(new WebApiHandler());
//With the url providers we can change node urls.
UrlProviderResolver.Current.InsertTypeBefore<DefaultUrlProvider, HomeUrlProvider>();
}