Пример #1
0
 public MainWindow()
 {
     InitializeComponent();
     System.Threading.Thread thread1 = new System.Threading.Thread(
         new System.Threading.ThreadStart(
             delegate(){
         IRCClient irc = new IRCClient(jsonlaoder.Address, jsonlaoder.Ports,
                                       jsonlaoder.Nickname, jsonlaoder.Password, jsonlaoder.Channel);
         PingSender ping = new PingSender(irc);
         ping.Start();
         while (true)
         {
             // Read any message from the chat room
             string message = irc.ReadMessage();
             // Print raw irc messages
             if (message.Contains("PRIVMSG"))
             {
                 canvas.Dispatcher.BeginInvoke(
                     System.Windows.Threading.DispatcherPriority.Normal,
                     new Action(
                         delegate(){
                     animate(splitMessage(message));
                 }
                         ));
             }
         }
     }
             ));
     thread1.Start();
 }
Пример #2
0
 // Empty constructor makes instance of Thread
 public PingSender(IRCClient irc)
 {
     _irc       = irc;
     pingSender = new Thread(new ThreadStart(this.Run));
 }