/// <summary> /// Default Constructor /// </summary> /// <param name="agcEvent">The AGCEvent being thrown</param> public AGCEventArgs(IAGCEvent agcEvent) { if (agcEvent.ID == AGCEventID.AllsrvEventID_ConnectedLobby) { _args = null; } _args = new ArrayList(agcEvent.PropertyCount); _description = agcEvent.Description; // Grab the event stats. // For some reason the following loop couldn't be iterated any other way. // This weird obj-ref way worked though. for (int i = 0; i < agcEvent.PropertyCount; i++) { object Counter = i; object Item = agcEvent.get_Property(ref Counter); if (Item != null) { if (Item is DateTime) { Item = ((DateTime)Item).ToLocalTime(); } _args.Add(Item); } } }
public AGCEventWrapper(IAGCEvent agcEvent) { this.ComputerName = agcEvent.ComputerName; this.Context = agcEvent.Context; this.Description = agcEvent.Description; this.ID = agcEvent.ID; this.PropertyCount = agcEvent.PropertyCount; this.SubjectID = agcEvent.SubjectID; this.SubjectName = agcEvent.SubjectName; this.Time = agcEvent.Time; this.AGCEventArgs = new AGCEventArgs(agcEvent); }
/// <summary> /// Callback that receives the AGCEvents from Allsrv /// </summary> public void OnEvent(IAGCEvent pEvent) { TagTrace.WriteLine(TraceLevel.Verbose, "AllsrvConnector::OnEvent(): Event received: {0}", pEvent.ID); ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessEvent), new AGCEventWrapper(pEvent)); }