private void OnRouteRequest(object sender, MessageRouter.MessageRouter_EventArgs args) { lock (m_InMessages) { args.Request.User = args.UserInfo; m_InMessages.Enqueue(args.Request); if (m_InMessages.Count == 1) { ThreadPool.QueueUserWorkItem(o => ThreadFunc_RequestWorker()); } } }
/// <summary> /// occurs when message router is removing a session /// </summary> /// <param name="sender">sender object</param> /// <param name="e">event parameters</param> void OnAddedSession_MsgRouter(object sender, MessageRouter.MessageRouter_EventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new Action <string, string>((o1, o2) => { AddSession(o1, o2); }), e.ID, e.UserInfo.Login); } else { AddSession(e.ID, e.UserInfo.Login); } }
/// <summary> /// occurs when message router is adding a new session /// </summary> /// <param name="sender">sender object</param> /// <param name="e">event parameters</param> void OnRemovedSession_MsgRouter(object sender, MessageRouter.MessageRouter_EventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new Action <string>(o => { RemoveSession(o); }), e.ID); } else { RemoveSession(e.ID); } }
void OnRemovedSession(object sender, MessageRouter.MessageRouter_EventArgs e) { UnsubscribeSymbolsBySessionID(e.ID); }