/// <summary> /// This method is called when ever the <see cref="Proxy_Singleton"> /// Proxy</see> ProxyCallBackEvent is raised, in response to an incoming message /// When this method is called it will examine the events /// ProxyCallBackEventArgs to see what type of message is being recieved, /// and will then call the correspoding method. /// <see cref="ChatProxy">Receive/ReceiveWhisper</see> are not dealt with /// as they are not relevant to this control. They are dealt with by /// <see cref="ChatControl">the ChatControl</see> /// </summary> /// <param name="sender">the sender, which is not used</param> /// <param name="e">The ChatEventArgs</param> private void ProxySingleton_ProxyCallBackEvent(object sender, ProxyCallBackEventArgs e) { switch (e.callbackType) { case CallBackType.Receive: Receive(e.person, e.message); break; case CallBackType.ReceiveWhisper: ReceiveWhisper(e.person, e.message); break; case CallBackType.UserEnter: UserEnter(e.person); break; case CallBackType.UserLeave: UserLeave(e.person); break; } }
/// <summary> /// Calls by either the UserEnter() or UserLeave() <see cref="IChatCallback">IChatCallback</see> /// method implementations, and simply raises the OnProxyCallBackEvent() event /// to any subscribers /// </summary> /// <param name="sender">The <see cref="Common.Person">current chatter</see></param> /// <param name="message">The message</param> /// <param name="callbackType">Could be <see cref="CallBackType">CallBackType.UserEnter</see> or /// <see cref="CallBackType">CallBackType.UserLeave</see></param> private void UserEnterLeave(Person person, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.person = person; e.callbackType = callbackType; OnProxyCallBackEvent(e); }
/// <summary> /// Calls by either the Receive() or ReceiveWhisper() <see cref="IChatCallback">IChatCallback</see> /// method implementations, and simply raises the OnProxyCallBackEvent() event /// to any subscribers /// </summary> /// <param name="sender">The <see cref="Common.Person">current chatter</see></param> /// <param name="message">The message</param> /// <param name="callbackType">Could be <see cref="CallBackType">CallBackType.Receive</see> or /// <see cref="CallBackType">CallBackType.ReceiveWhisper</see></param> private void Receive(Person sender, string message, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.message = message; e.callbackType = callbackType; e.person = sender; OnProxyCallBackEvent(e); }
/// <summary> /// Raises the event for connected subscribers /// </summary> /// <param name="e"><see cref="ProxyCallBackEventArgs">ProxyCallBackEventArgs</see> event args</param> protected void OnProxyCallBackEvent(ProxyCallBackEventArgs e) { if (ProxyCallBackEvent != null) { // Invokes the delegates. ProxyCallBackEvent(this, e); } }
void ProxySingleton_ProxyCallBackEvent(object sender, ProxyCallBackEventArgs e) { throw new Exception("The method or operation is not implemented."); }