/// <summary>Causes any configured Feed templates to be initialized, and if needed, registered.</summary> /// <remarks><para>While not an entirely optimal solution, this functionality is executed when the context is initialized because it /// requires knowledge of which API key is being used. This information isn't available until after the Facebook web objects are initialized. /// A value is set per-API key in the Application state so that it only executed once per API key during the lifetime of the appication.</para></remarks> void FacebookApplication_FacebookContextInit(Object sender, FacebookWebEventArgs e) { FacebookWebApplication.Init(FacebookHttpContext.Current); if (this.Application.Application["__FB_FEED_INIT_" + e.Context.ApiKey] == null) { lock (initFeedTemplatesLock) { if (this.Application.Application["__FB_FEED_INIT_" + e.Context.ApiKey] == null) { //if (Facebook.Configuration.FacebookSection.IsConfigured) //{ // var config = Facebook.Configuration.FacebookSection.Current; // if (!String.IsNullOrEmpty(Facebook.Configuration.FacebookSection.Current.FeedTemplateConfigSource)) // { // var templates = Facebook.Configuration.FeedTemplateBundles.Get(); ; // if (templates.Count > 0) // { // e.Context.Feed.InitFeedTemplates(); // } // } //} } } this.Application.Application["__FB_FEED_INIT_" + e.Context.ApiKey] = true; } }
/// <summary>Raises the <see cref="FacebookContextInit" /> event of the <see cref="FacebookHttpApplication" /> object.</summary> /// <param name="e">A <see cref="FacebookWebEventArgs" /> object that contains data about the event.</param> protected internal void OnFacebookContextInit(FacebookWebEventArgs e) { if (this.FacebookContextInit != null) { this.FacebookContextInit(this, e); } }