public void AfterInstall() { string token = SiteimproveHelper.RequestToken(); // Save the token in the repository var repo = ServiceLocator.Current.GetInstance <ISettingsRepository>(); repo.saveToken(token); }
private void ContentEvents_PublishedContent(object sender, ContentEventArgs e) { PageData page = e.Content as PageData; if (page == null) { return; } // Page is home page if (page.ContentLink.ID == ContentReference.StartPage.ID) { if (page.StopPublish.HasValue) { this._homeIsUnPublished = page.StopPublish <= DateTime.Now; } // In event "Publishing", homeIsPublished was false, now it is. Send a recrawl if (this._homeIsUnPublished && page.CheckPublishedStatus(PagePublishedStatus.Published)) { string url = SiteimproveHelper.GetExternalUrl(page); if (url != null) { SiteimproveHelper.PassEvent("recrawl", url, this._settingsRepository.getToken()); } this._homeIsUnPublished = false; return; } } if (page.CheckPublishedStatus(PagePublishedStatus.Published)) { string url = SiteimproveHelper.GetExternalUrl(page); if (url != null) { SiteimproveHelper.PassEvent("recheck", url, this._settingsRepository.getToken()); } } else { SiteimproveHelper.PassEvent("recheck", "", this._settingsRepository.getToken()); } }