public static void UpdateCategories() { foreach (var category in SnTrace.Categories) { category.Enabled = Settings.GetValue(SETTINGS_NAME, SETTINGS_PREFIX + category.Name, null, false); } SnLog.WriteInformation("Trace settings were updated.", EventId.RepositoryRuntime, properties: SnTrace.Categories.ToDictionary(c => c.Name, c => (object)c.Enabled.ToString())); }
private void StartSubscription() { var subscribe = Settings.GetValue <MailProcessingMode>( MailHelper.MAILPROCESSOR_SETTINGS, MailHelper.SETTINGS_MODE, this.Path) == MailProcessingMode.ExchangePush; if (subscribe) { // subscribe to email after saving content. this is done separately from saving the content, // since subscriptionid must be persisted on the content and we use cyclic retrials for that ExchangeHelper.Subscribe(this); } var parent = GetMailProcessorWorkflowContainer(this); if (parent == null) { return; } // get the workflow to start var incomingEmailWorkflow = this.GetReference <Node>("IncomingEmailWorkflow"); if (incomingEmailWorkflow == null) { return; } // set this list as the related content var workflowC = Content.CreateNew(incomingEmailWorkflow.Name, parent, incomingEmailWorkflow.Name); workflowC["RelatedContent"] = this; try { workflowC.Save(); } catch (Exception ex) { SnLog.WriteException(ex, categories: ExchangeHelper.ExchangeLogCategory); } // reflection: because we do not have access to the workflow engine here var t = TypeResolver.GetType("SenseNet.Workflow.InstanceManager", false); if (t == null) { return; } var m = t.GetMethod("Start", BindingFlags.Static | BindingFlags.Public); m.Invoke(null, new object[] { workflowC.ContentHandler }); }
public T GetValue <T>(string settingsName, string key, string contextPath, T defaultValue) { return(Settings.GetValue(settingsName, key, contextPath, defaultValue)); }