Exemple #1
0
 public void UpdateChat(string text)
 {
     // If the current thread is not the UI thread, InvokeRequired will be true
     if (text_log.InvokeRequired)
     {
         // If so, call Invoke, passing it a lambda expression which calls
         // UpdateText with the same label and text, but on the UI thread instead.
         text_log.Invoke((Action)(() => UpdateChat(text)));
         return;
     }
     // If we're running on the UI thread, we'll get here, and can safely update
     // the label's text.
     text_log.AppendText(text);
     text_log.ScrollToCaret();
     if (!focused)
     {
         try
         {
             string soundsFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
             string soundFile    = Path.Combine(soundsFolder + "trade_message.wav");
             using (System.Media.SoundPlayer player = new System.Media.SoundPlayer(soundFile))
             {
                 player.Play();
             }
         }
         catch (Exception ex)
         {
             bot.log.Error(ex.ToString());
         }
         FlashWindow.Flash(this);
     }
 }
Exemple #2
0
 private void Chat_Deactivate(object sender, EventArgs e)
 {
     FlashWindow.Stop(this);
     hasFocus = false;
 }
Exemple #3
0
 private void Chat_Activated(object sender, EventArgs e)
 {
     hasFocus = true;
     FlashWindow.Stop(this);
 }
Exemple #4
0
 public void Flash()
 {
     FlashWindow.Start(this);
 }