public void SignalEvent(string sentryAddOnName, string sentryName, string message) { var taskInfo = new SentryTaskInfo() { AssociateId = SoContext.CurrentPrincipal.AssociateId, AssociateName = SoContext.CurrentPrincipal.Associate, SentryName = sentryName, SentryAddOnName = sentryAddOnName, State = SentryState.Message, Message = message }; // This produces an item and puts it on the queue. // A background thread will dequeue the item and process it in SentryRightsDispatcher.ProcessTasks. GetDispatcher().Enqueue(taskInfo); }
private void ProcessTasks(SentryTaskInfo sentryTaskInfo) { Write("Plugin name: {0}, for {1}, invoked by Username: {2} - ID: {3}, for {4} : {5}", sentryTaskInfo.SentryAddOnName, sentryTaskInfo.SentryName, sentryTaskInfo.AssociateName, sentryTaskInfo.AssociateId, sentryTaskInfo.Type.ToString(), sentryTaskInfo.State.ToString()); if (sentryTaskInfo.State == SentryState.Message) { Write(sentryTaskInfo.Message); } if (sentryTaskInfo.Type == RightsType.TableRights) { Write(sentryTaskInfo?.TableRights); } else { Write(sentryTaskInfo?.FieldRights); } }
public void Enqueue(SentryTaskInfo sentryTaskInfo) { _queue.AddWork(sentryTaskInfo); }