Ejemplo n.º 1
0
 /// <summary>
 /// Raises the event for connected subscribers
 /// </summary>
 /// <param name="e"><see cref="ProxyEventArgs">ProxyEventArgs</see> event args</param>
 void OnProxyEvent(ProxyEventArgs e)
 {
     if (ProxyEvent != null)
     {
         // Invokes the delegates.
         ProxyEvent(this, e);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// If the input list is not empty, then call the
 /// OnProxyEvent() event, to raise the event for subscribers
 /// </summary>
 /// <param name="list">The list of <see cref="Common.Person">Chatters</see> </param>
 private void HandleEndJoin(Person[] list)
 {
     if (list == null)
     {
         MessageBox.Show("Error: List is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ExitChatSession();
     }
     else
     {
         ProxyEventArgs e = new ProxyEventArgs();
         e.list = list;
         OnProxyEvent(e);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// This method checks to see if the current thread needs to be marshalled
 /// to the correct (UI owner) thread. If it does a new delegate is created
 /// which recalls this method on the correct thread
 /// </summary>
 /// <param name="sender"><see cref="Proxy_Singleton">ProxySingleton</see></param>
 /// <param name="e">The event args</param>
 private void ProxySingleton_ProxyEvent(object sender, ProxyEventArgs e)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                     new ProxySingleton_ProxyEvent_Delegate(ProxySingleton_ProxyEvent),
                                     sender, new object[] { e });
         return;
     }
     //now marshalled to correct thread so proceed
     foreach (Person person in e.list)
     {
         lstChatters.Items.Add(person);
     }
     this.ChatControl.AppendText("Connected at " + DateTime.Now.ToString() + " with user name " + currPerson.Name + Environment.NewLine);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// This method checks to see if the current thread needs to be marshalled
 /// to the correct (UI owner) thread. If it does a new delegate is created
 /// which recalls this method on the correct thread
 /// </summary>
 /// <param name="sender"><see cref="Proxy_Singleton">ProxySingleton</see></param>
 /// <param name="e">The event args</param>
 private void ProxySingleton_ProxyEvent(object sender, ProxyEventArgs e)
 {
     if (!this.Dispatcher.CheckAccess())
     {
         this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
         new ProxySingleton_ProxyEvent_Delegate(ProxySingleton_ProxyEvent),
         sender, new object[] { e });
         return;
     }
     //now marshalled to correct thread so proceed
     foreach (Person person in e.list)
     {
         lstChatters.Items.Add(person);
     }
     this.ChatControl.AppendText("Connected at " + DateTime.Now.ToString() + " with user name " + currPerson.Name + Environment.NewLine);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// If the input list is not empty, then call the 
 /// OnProxyEvent() event, to raise the event for subscribers
 /// </summary>
 /// <param name="list">The list of <see cref="Common.Person">Chatters</see> </param>
 private void HandleEndJoin(Person[] list)
 {
     if (list == null)
     {
         MessageBox.Show("Error: List is empty", "Error",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
         ExitChatSession();
     }
     else
     {
         ProxyEventArgs e = new ProxyEventArgs();
         e.list = list;
         OnProxyEvent(e);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Raises the event for connected subscribers
 /// </summary>
 /// <param name="e"><see cref="ProxyEventArgs">ProxyEventArgs</see> event args</param>
 protected void OnProxyEvent(ProxyEventArgs e)
 {
     if (ProxyEvent != null)
     {
         // Invokes the delegates.
         ProxyEvent(this, e);
     }
 }
Ejemplo n.º 7
0
 void ProxySingleton_ProxyEvent(object sender, ProxyEventArgs e)
 {
     throw new Exception("The method or operation is not implemented.");
 }