public void Initialize(InitializationEngine context) { if (_initialized || ContentReference.IsNullOrEmpty(GlobalNewsContainer) || context.HostType != HostType.WebApplication) { return; } var providerManager = ServiceLocator.Current.GetInstance<IContentProviderManager>(); var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>(); var startPages = contentLoader.GetChildren<PageData>(SiteDefinition.Current.RootPage).OfType<StartPage>(); // Attach content provider to each site's global news container foreach (var startPage in startPages.Where(startPage => !ContentReference.IsNullOrEmpty(startPage.GlobalNewsPageLink))) { try { Logger.Debug("Attaching global news content provider to page {0} [{1}], global news will be retrieved from page {2} [{3}]", contentLoader.Get<PageData>(startPage.GlobalNewsPageLink).Name, startPage.GlobalNewsPageLink.ID, contentLoader.Get<PageData>(GlobalNewsContainer).PageName, GlobalNewsContainer.ID); var provider = new ClonedContentProvider(GlobalNewsContainer.ToPageReference(), startPage.GlobalNewsPageLink, startPage.Category); providerManager.ProviderMap.AddProvider(provider); } catch (Exception ex) { Logger.Error("Unable to create global news content provider for start page with ID {0}: {1}", startPage.PageLink.ID, ex.Message); } } _initialized = true; }
public void Initialize(InitializationEngine context) { _provider = ServiceLocator.Current.GetInstance<IDisplayModeFallbackProvider>(); _provider?.Initialize(); RegisterDisplayOptions(); }
/// <summary> /// The initialize. /// </summary> /// <param name="context"> /// The context. /// </param> public void Initialize(InitializationEngine context) { if (this.initialized || context == null || context.HostType != HostType.WebApplication) { return; } Logger.Info("[OutputFormats] Initializing Output WebApi."); context.Locate.DisplayChannelService() .RegisterDisplayMode( new DefaultDisplayMode(OutputConstants.JSON) { ContextCondition = ContextHelper.IsJsonDisplayModeActive }, 0); context.Locate.DisplayChannelService() .RegisterDisplayMode( new DefaultDisplayMode(OutputConstants.XML) { ContextCondition = ContextHelper.IsXmlDisplayModeActive }, 0); context.Locate.DisplayChannelService() .RegisterDisplayMode( new DefaultDisplayMode(OutputConstants.Text) { ContextCondition = ContextHelper.IsTxtDisplayModeActive }, 0); context.Locate.DisplayChannelService() .RegisterDisplayMode( new DefaultDisplayMode(OutputConstants.PDF) { ContextCondition = ContextHelper.IsPdfDisplayModeActive }, 0); this.initialized = true; Logger.Info("[OutputFormats] Output WebApi initialized."); }
// protected Injected<SettingsRepository> SettingsRepository { get; set; } public void Initialize(InitializationEngine context) { var registerFolder = context.Locate.Advanced.GetInstance<SingleModelRegister<InstagramFolder>>(); registerFolder.RegisterType(); var registerInstaImage = context.Locate.Advanced.GetInstance<SingleModelRegister<InstaImage>>(); registerInstaImage.RegisterType(); var contentRepository = context.Locate.ContentRepository(); var entryPoint = contentRepository.GetChildren<InstagramFolder>(ContentReference.RootPage).FirstOrDefault(); if (entryPoint == null) { entryPoint = contentRepository.GetDefault<InstagramFolder>(ContentReference.RootPage); entryPoint.Name = "Instagram"; contentRepository.Save(entryPoint, SaveAction.Publish, AccessLevel.NoAccess); } // Register custom content provider var providerValues = new NameValueCollection(); providerValues.Add(ContentProviderElement.EntryPointString, entryPoint.ContentLink.ID.ToString()); providerValues.Add(ContentProviderElement.CapabilitiesString, ContentProviderElement.FullSupportString); var instagramProvider = new InstagramContentProvider((context.Locate.ContentTypeRepository())); instagramProvider.Initialize("instagramprovider", providerValues); var providerManager = context.Locate.Advanced.GetInstance<IContentProviderManager>(); providerManager.ProviderMap.AddProvider(instagramProvider); }
public void Initialize(InitializationEngine context) { logger.Info("attaching to DataFactory.Instance.CreatingPage"); DataFactory.Instance.CreatingPage += CheckConstraints; DataFactory.Instance.SavingPage += CheckConstraints; DataFactory.Instance.PublishingPage += CheckConstraints; }
public void Initialize(InitializationEngine context) { RouteTable.Routes.MapRoute( "GetaTags", "getatags", new { action = "Index", controller = "GetaTags" }); }
public void Initialize(InitializationEngine context) { if (context.HostType == HostType.WebApplication) { RegisterBundles(BundleTable.Bundles); } }
public void Initialize(InitializationEngine context) { if (context.HostType == HostType.WebApplication) { XFormControl.ControlSetup += new EventHandler(XForm_ControlSetup); } }
public void Initialize(InitializationEngine context) { _tagService = new TagService(); _pageTypeRepository = ServiceLocator.Current.GetInstance<PageTypeRepository>(); DataFactory.Instance.PublishedPage += OnPublishedPage; }
/// <summary> /// Initializes the specified context. /// </summary> /// <param name="context">The context.</param> public void Initialize(InitializationEngine context) { if (_initialized) { return; } _contentEvents.Service.CreatingContent += CreatingContent; _contentEvents.Service.MovingContent += MovingContent; var contentTypes = _contentTypeRepository.Service.List(); var disableAtMax = false; foreach (var contentType in contentTypes) { if (contentType.ModelType.IsDefined(typeof(RestrictMultipleAttribute), false)) { var attribute = contentType.ModelType.GetCustomAttributes(typeof(RestrictMultipleAttribute), false)[0] as RestrictMultipleAttribute; if (attribute.DisableAtMax) { disableAtMax = true; break; } } } if (disableAtMax) { _contentEvents.Service.CreatedContent += CreatedContent; _contentEvents.Service.DeletedContent += DeletedContent; } _initialized = true; }
public void Initialize(InitializationEngine context) { if (PayExSettings.Instance.DisablePaymentMethodCreation) return; string paymentGatewayClassname = ConcatenateClassAndAssemblyName(typeof(PayExPaymentGateway)); string payExPaymentClassName = ConcatenateClassAndAssemblyName(typeof (PayExPayment)); string extendedPayExPaymentClassName = ConcatenateClassAndAssemblyName(typeof(ExtendedPayExPayment)); var paymentMethodInfo = new List<PaymentMethodInfo> { new PaymentMethodInfo(Constants.Payment.CreditCard.SystemKeyword, Constants.Payment.CreditCard.Name, paymentGatewayClassname, payExPaymentClassName, 1000), new PaymentMethodInfo(Constants.Payment.InvoiceLedger.SystemKeyword, Constants.Payment.InvoiceLedger.Name, paymentGatewayClassname, payExPaymentClassName, 1100), new PaymentMethodInfo(Constants.Payment.Invoice.SystemKeyword, Constants.Payment.Invoice.Name, paymentGatewayClassname, payExPaymentClassName, 1200), new PaymentMethodInfo(Constants.Payment.DirectDebit.SystemKeyword, Constants.Payment.DirectDebit.Name, paymentGatewayClassname, payExPaymentClassName, 1300), new PaymentMethodInfo(Constants.Payment.PartPayment.SystemKeyword, Constants.Payment.PartPayment.Name, paymentGatewayClassname, extendedPayExPaymentClassName, 1400), new PaymentMethodInfo(Constants.Payment.PayPal.SystemKeyword, Constants.Payment.PayPal.Name, paymentGatewayClassname, payExPaymentClassName, 1500), new PaymentMethodInfo(Constants.Payment.Giftcard.SystemKeyword, Constants.Payment.Giftcard.Name, paymentGatewayClassname, payExPaymentClassName, 1600), new PaymentMethodInfo(Constants.Payment.MasterPass.SystemKeyword, Constants.Payment.MasterPass.Name, paymentGatewayClassname, payExPaymentClassName, 1700), new PaymentMethodInfo(Constants.Payment.FinancingInvoiceNorway.SystemKeyword, Constants.Payment.FinancingInvoiceNorway.Name, paymentGatewayClassname, extendedPayExPaymentClassName, 1800), new PaymentMethodInfo(Constants.Payment.FinancingInvoiceSweden.SystemKeyword, Constants.Payment.FinancingInvoiceSweden.Name, paymentGatewayClassname, extendedPayExPaymentClassName, 1900), }; CreateForEnabledLanguages(paymentMethodInfo); }
/// <summary> /// Initialize /// </summary> /// <param name="context"></param> public void Initialize(InitializationEngine context) { SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add<Employee>(); SearchClient.Instance.Conventions.UnifiedSearchRegistry.Add<Company>(); SearchClient.Instance.Conventions.NestedConventions.Add<Company>(company => company.Employees); }
public void Initialize(InitializationEngine context) { FeedInformationHandler.SetDefaultBehaviour(); var resolver = ServiceLocator.Current.GetInstance<TemplateResolver>(); resolver.TemplateResolved += TemplateResolverOnTemplateResolved; }
public void CanInitialize() { var initializationEngine = new InitializationEngine(); var restrictMultipleAttributeInitialization = new RestrictMultipleAttributeInitialization(); restrictMultipleAttributeInitialization.Initialize(initializationEngine); }
public void Uninitialize(InitializationEngine context) { var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>(); contentEvents.CreatingContent -= ContentEventsOnCreatingContent; contentEvents.MovingContent -= ContentEventsOnMovingContent; }
void IInitializableModule.Uninitialize(InitializationEngine context) { if (_enabled) { DataImporter.Importing -= DataImporter_Importing; DataImporter.ContentImporting -= DataImporter_ContentImporting; } }
public void Initialize(InitializationEngine context) { GlobalConfiguration.Configure(delegate(HttpConfiguration config){ config.EnsureInitialized(); config.Formatters.Add(new BinaryMediaTypeFormatter()); }); }
public void Initialize(InitializationEngine context) { this._tagService = ServiceLocator.Current.GetInstance<ITagService>(); this._contentTypeRepository = ServiceLocator.Current.GetInstance<IContentTypeRepository>(); this._contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>(); this._contentEvents.PublishedContent += OnPublishedContent; }
public void Initialize(InitializationEngine context) { var mobileChannelDisplayMode = new DefaultDisplayMode("mobile") { ContextCondition = IsMobileDisplayModeActive }; DisplayModeProvider.Instance.Modes.Insert(0, mobileChannelDisplayMode); }
public void Initialize(InitializationEngine context) { if (string.IsNullOrWhiteSpace(PayExSettings.Instance.AccountNumber.ToString())) Log.Error("The PayEx payment provider will not work unless you supply an Account Number in the payment provider module settings!"); if (string.IsNullOrWhiteSpace(PayExSettings.Instance.EncryptionKey)) Log.Error("The PayEx payment provider will not work unless you supply an encryption key in the payment provider module settings!"); }
public void Initialize(InitializationEngine context) { //Add initialization logic, this method is called once after CMS has been initialized var repo = ServiceLocator.Current.GetInstance<IContentEvents>(); repo.MovingContent += RepoOnMovingContent; }
public void Uninitialize(InitializationEngine context) { var eventRegistry = ServiceLocator.Current.GetInstance<IContentEvents>(); eventRegistry.CreatingContent -= SavingMediaFile; eventRegistry.SavingContent -= SavingMediaFile; }
public System.Collections.Generic.IEnumerable<VirtualPathProvider> CreateProviders(InitializationEngine context) { if (context.HostType.Equals(HostType.WebApplication)) { return new VirtualPathProvider[] { new AssemblyResourceProvider() }; } return Enumerable.Empty<VirtualPathProvider>(); }
public void Initialize(InitializationEngine context) { DataFactory.Instance.CreatingPage +=Instance_CreatingPage; var partialRouter = new BlogPartialRouter(); RouteTable.Routes.RegisterPartialRouter<BlogStartPage, Category>(partialRouter); }
public void Initialize(InitializationEngine context) { if (!_eventsAttached) { //TODO: Cant find out how to do this using the repo DataFactory.Instance.PublishingContent += this.OnPublishingContent; _eventsAttached = true; } }
public void Initialize(InitializationEngine context) { //Add custom view engine allowing partials to be placed in additional locations //Note that we add it first in the list to optimize view resolving when using DisplayFor/PropertyFor ViewEngines.Engines.Insert(0, new SiteViewEngine()); context.Locate.TemplateResolver() .TemplateResolved += TemplateCoordinator.OnTemplateResolved; }
private void AddAssociationGroups(InitializationEngine context) { // Add predefined selections CrossSell and UpSell // If they already exist nothing will be added var associationDefinitionRepository = context.Locate.Advanced.GetInstance<GroupDefinitionRepository<AssociationGroupDefinition>>(); associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = Constants.CrossSellGroupName }); associationDefinitionRepository.Add(new AssociationGroupDefinition { Name = Constants.UpSellGroupName }); }
public void Initialize(InitializationEngine context) { var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>(); contentEvents.DeletedContent += ContentEventsOnDeletedContent; contentEvents.DeletedContentLanguage += ContentEventsOnPublishedContent; contentEvents.DeletedContentVersion += ContentEventsOnPublishedContent; contentEvents.MovedContent += ContentEventsOnPublishedContent; contentEvents.PublishedContent += ContentEventsOnPublishedContent; }
void IInitializableModule.Initialize(InitializationEngine context) { _enabled = ServiceLocator.Current.GetInstance<IComposerImportOptions>().Enabled; if (_enabled) { DataImporter.Importing += DataImporter_Importing; DataImporter.ContentImporting += DataImporter_ContentImporting; } }
public void Initialize(InitializationEngine context) { Log.Debug("Initializing 404 handler version check"); var dba = DataAccessBaseEx.GetWorker(); var version = dba.CheckModuleVersion(); if (version != RedirectConfiguration.CurrentVersion) StartUpgrade(version); else Upgrader.Valid = true; }
public static void InitializeFoundationFindCms(this InitializationEngine context) { InitializeFacets(_facetConfigFactory.Value.GetFacetFilterConfigurationItems()); _contentEvents.Value.PublishedContent += OnPublishedContent; }
public void Initialize(InitializationEngine context) { context.InitComplete += Context_InitComplete; }
public void Uninitialize(InitializationEngine context) { context.Locate.Advanced.GetInstance <OrderEventListener>().RemoveEvents(); }
public void Uninitialize(InitializationEngine context) { OrderContext.Current.OrderGroupUpdated -= Current_OrderGroupUpdated; }
public void Initialize(InitializationEngine context) { context.Locate.Advanced.GetInstance <IGoogleProductFeedService>().CreateFeed <VariationContent>("Default"); }
public void Uninitialize(InitializationEngine initializationEngine) { }
/// <summary> /// Resets the module into an uninitialized state. /// /// </summary> /// <param name="context">The context.</param> /// <remarks> /// /// <para> /// This method is usually not called when running under a web application since the web app may be shut down very /// abruptly, but your module should still implement it properly since it will make integration and unit testing /// much simpler. /// /// </para> /// /// <para> /// Any work done by <see cref="M:EPiServer.Framework.IInitializableModule.Initialize(EPiServer.Framework.Initialization.InitializationEngine)"/> as well as any code executing on <see cref="E:EPiServer.Framework.Initialization.InitializationEngine.InitComplete"/> should be reversed. /// /// </para> /// /// </remarks> public void Uninitialize(InitializationEngine context) { //_broadcaster.InventoryUpdated -= _listener.InventoryUpdated; //_broadcaster.PriceUpdated -= _listener.PriceUpdated; //_listener.RemoveEvent(); }
void IInitializableModule.Initialize(InitializationEngine context) => context.InitComplete += (sender, eventArgs) => context.Locate.Advanced.GetInstance <ISettingsService>().InitializeSettings();
public void Initialize(InitializationEngine context) { //Add initialization logic, this method is called once after CMS has been initialized GlobalFilters.Filters.Add(ServiceLocator.Current.GetInstance <PageContextActionFilter>()); }
public void Initialize(InitializationEngine context) { CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false); }
void IInitializableModule.Uninitialize(InitializationEngine context) { }
public void Uninitialize(InitializationEngine context) { ServiceLocator.Current.GetInstance <TemplateResolver>() .TemplateResolved -= TemplateCoordinator.OnTemplateResolved; }
public void Initialize(InitializationEngine context) { GlobalFilters.Filters.Add(ServiceLocator.Current.GetInstance <PageContextActionFilter>()); }
public void Uninitialize(InitializationEngine context) { }
public void Uninitialize(InitializationEngine context) { ConfigurationContext.Current.CacheManager.OnRemove -= CacheManagerOnOnRemove; }
public void Uninitialize(InitializationEngine context) { DataFactory.Instance.LoadedPage -= DataFactory_LoadedPage; DataFactory.Instance.LoadedChildren -= DataFactory_LoadedChildren; DataFactory.Instance.LoadedDefaultPageData -= DataFactory_LoadedPage; }
public void Uninitialize(InitializationEngine context) { context.Locate.ContentEvents().SavingContent -= _contentEventHandlers.SavingContentHandler; }
public void Uninitialize(InitializationEngine context) => context.Locate.Advanced.GetInstance <ITemplateResolverEvents>().TemplateResolved -= TemplateCoordinator.OnTemplateResolved;
public void Initialize(InitializationEngine initializationEngine) { Logger.Debug("Start Initialize()"); CreateTable(); }
public void Uninitialize(InitializationEngine context) { DataExportEvents.Service.ContentExporting -= DataExportEvents_ContentExporting; }
public void Uninitialize(InitializationEngine context) { context.InitComplete -= ContextOnInitComplete; }
public void Initialize(InitializationEngine context) { // routing fund. //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes,, false); // routing adv. CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () => { // the scheduled job still have troubles var contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>(); // If epi-Find-error in exercise, it's the "catalog start" var startPage = new ContentReference(9); //var startPage = contentLoader.Get<PageData>(ContentReference.StartPage); if (startPage == null) // should maybe check for the "setting-prop" { return(ContentReference.WasteBasket); //.StartPage; } //var homePage = startPage as StartPage; //return homePage != null ? homePage.Settings.catalogStartPageLink : ContentReference.StartPage; // if Find issues return(startPage); } , false); #region Partial Routing Simplified... Conceptually //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () => //{ // var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>(); // var startPage = contentLoader.Get<StartPage>(ContentReference.StartPage); // return startPage.Settings.catalogStartPageLink; //} //, false); #endregion #region Events CMS & ECF // Nice for Entry Pricing and Inventory updates CatalogKeyEventBroadcaster e = ServiceLocator.Current.GetInstance <CatalogKeyEventBroadcaster>(); e.PriceUpdated += e_PriceUpdated; e.InventoryUpdated += e_InventoryUpdated; Event.Get(CatalogEventBroadcaster.CommerceProductUpdated).Raised += EB; // this is the old one for Orders //OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated; // Good stuff for Orders ...\Infrastructure\CartAndCheckout\NewOrderEvents.cs //IOrderRepositoryCallback orc = // ServiceLocator.Current.GetInstance<IOrderRepositoryCallback>(); IContentEvents e2 = ServiceLocator.Current.GetInstance <IContentEvents>(); // ...the way to go e2.RequestedApproval += E2_RequestedApproval; e2.PublishedContent += E2_PublishedContent; #endregion // new in 10.1.0 SetPromotionExclusions(context); }
public void Initialize(InitializationEngine context) { _locator = context.Locate.Advanced; OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated; }
public void Initialize(InitializationEngine context) { //Add initialization logic, this method is called once after CMS has been initialized }
public void Uninitialize(InitializationEngine context) { //Add uninitialization logic }
public void Initialize(InitializationEngine context) { DependencyResolver.SetResolver(new ServiceLocatorDependencyResolver(context.Locate.Advanced)); }
public void Uninitialize(InitializationEngine context) { _routingEventHandler?.Dispose(); _routingEventHandler = null; }
public void Initialize(InitializationEngine context) { CatalogEventBroadcaster.Instance.LocalEntryUpdating += InstanceOnLocalEntryUpdating; CatalogEventBroadcaster.Instance.LocalRelationUpdating += InstanceOnLocalRelationUpdating; }
public void Uninitialize(InitializationEngine context) { Global.RoutesRegistrating -= Global_RoutesRegistrating; }
public void Initialize(InitializationEngine context) { ContentIndexer.Instance.Conventions.ForInstancesOf <IContent>().ShouldIndex(_ => false); ContentIndexer.Instance.Conventions.ForInstancesOf <PageData>().ShouldIndex(ShouldIndexPage); ContentIndexer.Instance.Conventions.ForInstancesOf <MediaData>().ShouldIndex(ShouldIndexMedia); }