//----< get Receiver and Sender running >----------------------------

        void setupChannel()
        {
            rcvr = new Receiver(localPort, localAddress);
            Action serviceAction = () =>
            {
                try
                {
                    Message rmsg = null;
                    while (true)
                    {
                        rmsg = rcvr.getMessage();
                        Action act = () => { postRcvMsg(rmsg.content); };
                        Dispatcher.Invoke(act, System.Windows.Threading.DispatcherPriority.Background);
                    }
                }
                catch (Exception ex)
                {
                    Action act = () => { lStat.Text = ex.Message; };
                    Dispatcher.Invoke(act);
                }
            };

            if (rcvr.StartService())
            {
                rcvr.doService(serviceAction);
            }

            sndr = new wpfSender(lStat, this.Dispatcher);
        }
예제 #2
0
        void setupChannel()
        {
            rcvr = new Receiver(localPort, localAddress);
            Action serviceAction = () =>
            {
                try
                {
                    while (true)
                    {
                        Action act = () =>
                        {
                            displayPerformanceDetails(sndr.GetPerformanceDetails());
                        };
                        Dispatcher.Invoke(act, System.Windows.Threading.DispatcherPriority.Background);
                    }
                }
                catch (Exception ex)
                {
                    Action act = () => { rStat.Text = ex.Message; };
                    Dispatcher.Invoke(act);
                }
            };

            if (rcvr.StartService())
            {
                rcvr.doService(serviceAction);
            }

            sndr = new wpfSender(rStat, this.Dispatcher);
        }
예제 #3
0
 void setupChannel()
 {
     try
     {
         rcvr = new Receiver(localPort, localAddress);
         Action serviceAction = () =>
         {
             try
             {
                 Message rmsg = null;
                 while (true)
                 {
                     rmsg = rcvr.getMessage();
                     Action act = () => { postRcvMsg(rmsg.content, rmsg.fromUrl); };
                     Dispatcher.Invoke(act, System.Windows.Threading.DispatcherPriority.Background);
                 }
             }
             catch (Exception ex)
             {
                 Action act = () =>
                 {
                     lblError.Content = ex.Message;
                 };
                 Dispatcher.Invoke(act);
             }
         };
         if (rcvr.StartService())
         {
             rcvr.doService(serviceAction);
         }
         TextBox lStat = new TextBox();
         sndr = new wpfSender(lStat, this.Dispatcher);
     }
     catch (CustomException wx)
     {
         Console.Write("Error in WPF client : {0}\n", wx.Message);
     }
 }
예제 #4
0
        //----< get Receiver and Sender running >----------------------------
        void setupChannel()
        {
            rcvr = new Receiver(localPort, localAddress);
              Action serviceAction = () =>
              {
            try
            {
              Message rmsg = null;
              while (true)
              {
            rmsg = rcvr.getMessage();
            Action act = () => { postRcvMsg(rmsg.content); };
            Dispatcher.Invoke(act, System.Windows.Threading.DispatcherPriority.Background);
              }
            }
            catch(Exception ex)
            {
              Action act = () => { lStat.Text = ex.Message; };
              Dispatcher.Invoke(act);
            }
              };
              if (rcvr.StartService())
              {
            rcvr.doService(serviceAction);
              }

              sndr = new wpfSender(lStat, this.Dispatcher);
        }