public bool RegisterEvent(ILightEvent @event) { string key = @event.Config.ID; if (string.IsNullOrWhiteSpace(key) || Events.ContainsKey(key)) { return(false); } Events.Add(key, @event); if (@event.Config.ProcessNames != null) { foreach (string exe in @event.Config.ProcessNames) { if (!exe.Equals(key)) { EventProcesses.Add(exe.ToLower(), key); } } } if (@event.Config.ProcessTitles != null) { foreach (string titleRx in @event.Config.ProcessTitles) { EventTitles.Add(titleRx, key); } } if (!String.IsNullOrWhiteSpace(@event.Config.AppID)) { EventAppIDs.Add(@event.Config.AppID, key); } if (@event is Application) { if (!Global.Configuration.ProfileOrder.Contains(key)) { Global.Configuration.ProfileOrder.Add(key); } } this.InsertLightEvent(@event); if (Initialized) { @event.Initialize(); } return(true); }
public override void EnterProperty([NotNull] DfmGrammarParser.PropertyContext context) { if (context.qualifiedIdent().GetText() == "Events") { foreach (var item in context.propertyValue().itemList().item()) { var textProp = GetPropertyByName(item, "ISBLText"); if (textProp == null) { continue; } var text = DfmParseUtils.GetTextPropValue(textProp); if (this.action != null) { this.action.CalculationText = text; } else { var typeProp = GetPropertyByName(item, "EventType"); var name = typeProp?.propertyValue().GetText() ?? string.Empty; if (!EventTitles.TryGetValue(name, out string title)) { title = name; } var wizardEvent = new WizardEvent { Name = name, Title = title, CalculationText = text }; if (this.step != null) { this.step.Events.Add(wizardEvent); } else if (this.wizard != null) { this.wizard.Events.Add(wizardEvent); } } } } }