Esempio n. 1
0
 private void testGameDetectionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     StateTimer timer = new StateTimer(5000.0);
     timer.AutoReset = true;
     timer.Elapsed += new ElapsedEventHandler(this.timer_Elapsed);
     timer.Start();
 }
Esempio n. 2
0
 private void AddSpeaker(User user)
 {
     ElapsedEventHandler handler = null;
     if (Program.Settings.Chat.ShowSpeaking && Chatroom.InChatroom)
     {
         if (this.SpeakingTimers.ContainsKey(user.Name))
         {
             this.SpeakingTimers[user.Name].Interval = this.SpeakingInterval;
         }
         else
         {
             TextContainer<StatusTextLine> container;
             VGen0 gen = null;
             StatusTextLine userLine = this.ChatContainers.Pop(user.Name, out container);
             if (userLine != null)
             {
                 if (container.Count < 1)
                 {
                     this.RefreshData = true;
                 }
                 if (gen == null)
                 {
                     gen = delegate {
                         if (this.ChatContainerLookup["Speaking"].Count < 1)
                         {
                             this.RefreshData = true;
                         }
                         this.ChatContainerLookup["Speaking"].Add(userLine);
                     };
                 }
                 this.ChatroomQueue.Enqueue(gen, new object[0]);
             }
             StateTimer timer = new StateTimer((double) this.SpeakingInterval);
             timer.AutoReset = false;
             timer.State = user;
             if (handler == null)
             {
                 handler = delegate (object sender, ElapsedEventArgs e) {
                     VGen0 target = null;
                     User _user = (User) (sender as StateTimer).State;
                     if (this.SpeakingTimers.ContainsKey(_user.Name))
                     {
                         this.SpeakingTimers.Remove(_user.Name);
                         if (this.ChatContainerLookup["Speaking"].Remove(_user.Name))
                         {
                             if (this.ChatContainerLookup["Speaking"].Count < 1)
                             {
                                 this.RefreshData = true;
                             }
                             if (target == null)
                             {
                                 target = delegate {
                                     this.AddChatParticipant(_user);
                                 };
                             }
                             this.ChatroomQueue.Enqueue(target, new object[0]);
                         }
                     }
                 };
             }
             timer.Elapsed += handler;
             this.SpeakingTimers[user.Name] = timer;
             timer.Start();
         }
     }
 }