private void Main() { try { // delay the check for updates Thread.Sleep(1000); // only run one service-update at a time process wide lock (_serviceUpdateLock) { // establish settings detection context ServiceUpdateSettingsDetectionContext settingsDetectionContext = new ServiceUpdateSettingsDetectionContext(_blogId); // fire-up a blog settings detector to query for changes BlogSettingsDetector settingsDetector = new BlogSettingsDetector(settingsDetectionContext); settingsDetector.SilentMode = true; using (RegistryKey key = Registry.CurrentUser.OpenSubKey(ApplicationEnvironment.SettingsRootKeyName + @"\Weblogs\" + _blogId + @"\HomepageOptions")) { if (key != null) { settingsDetector.IncludeFavIcon = false; settingsDetector.IncludeCategories = settingsDetectionContext.BlogSupportsCategories; settingsDetector.UseManifestCache = true; settingsDetector.IncludeHomePageSettings = false; settingsDetector.IncludeCategoryScheme = false; settingsDetector.IncludeInsecureOperations = false; } } settingsDetector.IncludeImageEndpoints = false; settingsDetector.DetectSettings(SilentProgressHost.Instance); // write the settings using (ProcessKeepalive.Open()) { using (BlogSettings settings = BlogSettings.ForBlogId(_blogId)) settings.ApplyUpdates(settingsDetectionContext); } // if changes were made then fire an event to notify the UI if (settingsDetectionContext.HasUpdates) { _settingsChangedHandler(_blogId, false); } } } catch (ManualKeepaliveOperationException) { } catch (Exception ex) { Trace.Fail("Unexpected exception during ServiceUpdateChecker.Main: " + ex.ToString()); } }