Exemple #1
0
 /// <summary>
 /// Fires the content of the before refresh.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="umbraco.cms.businesslogic.RefreshContentEventArgs"/> instance containing the event data.</param>
 protected virtual void FireBeforeRefreshContent(RefreshContentEventArgs e)
 {
     if (BeforeRefreshContent != null)
     {
         BeforeRefreshContent(null, e);
     }
 }
Exemple #2
0
 /// <summary>
 /// Fires the content of the after refresh.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="umbraco.cms.businesslogic.RefreshContentEventArgs"/> instance containing the event data.</param>
 protected virtual void FireAfterRefreshContent(RefreshContentEventArgs e)
 {
     if (AfterRefreshContent != null)
     {
         AfterRefreshContent(null, e);
     }
 }
Exemple #3
0
        /// <summary>
        /// Load content from database in a background thread
        /// Replaces active content when done.
        /// </summary>
        public virtual void RefreshContentFromDatabaseAsync()
        {
            var e = new RefreshContentEventArgs();
            FireBeforeRefreshContent(e);

            if (!e.Cancel)
            {
                ThreadPool.QueueUserWorkItem(
                    delegate
                    {
                        XmlDocument xmlDoc = LoadContentFromDatabase();
                        XmlContentInternal = xmlDoc;

                        // It is correct to manually call PersistXmlToFile here event though the setter of XmlContentInternal
                        // queues this up, because this delegate is executing on a different thread and may complete
                        // after the request which invoked it (which would normally persist the file on completion)
                        // So we are responsible for ensuring the content is persisted in this case.
                        if (!UmbracoSettings.isXmlContentCacheDisabled &&
                            UmbracoSettings.continouslyUpdateXmlDiskCache)
                            PersistXmlToFile(xmlDoc);
                    });

                FireAfterRefreshContent(e);
            }
        }