private void OnlineHotkey(int effect)
 {
     if (DS3Interop.InLoadingScreen())
     {
         return;
     }
     if (effect == 11 && Settings.Default.SpamRedEyeOrb)
     {
         reoSpamming ^= true;
         reoSpamCnt   = 0;
         if (!reoSpamming && DS3Interop.IsSearchingInvasion())
         {
             DS3Interop.ApplyEffect(11);
         }
     }
     else
     {
         DS3Interop.ApplyEffect(effect);
     }
 }
        private void UpdateTimer_Tick(object sender, EventArgs e)
        {
            Player.UpdatePlayerList();
            Player.UpdateInGameInfo();
            playerData.Clear();

            foreach (Player p in Player.ActivePlayers())
            {
                playerData.Add(p);
            }

            // Update session info column sizes
            foreach (var col in dataGridSession.Columns)
            {
                col.Width = new DataGridLength(1, DataGridLengthUnitType.Pixel);
                col.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
            }
            dataGridSession.UpdateLayout();

            // Update overlay column sizes
            foreach (var col in overlay.dataGrid.Columns)
            {
                col.Width = new DataGridLength(1, DataGridLengthUnitType.Pixel);
                col.Width = new DataGridLength(1, DataGridLengthUnitType.SizeToCells);
            }
            overlay.dataGrid.UpdateLayout();

            // Queue position update after the overlay has re-rendered
            Dispatcher.BeginInvoke(DispatcherPriority.ContextIdle, new Action(overlay.UpdatePosition));

            DS3Interop.NetStatus status = DS3Interop.GetNetworkState();
            if (reoSpamming && !Settings.Default.SpamRedEyeOrb)
            {
                reoSpamming = false;
                reoSpamCnt  = 0;
            }
            if (status == DS3Interop.NetStatus.None)
            {
                if (hadInvaded && !reoSpamming)
                {
                    DS3Interop.ApplyEffect(11);
                }
                if (reoSpamming)
                {
                    reoSpamCnt = (reoSpamCnt + 1) % 5;
                    if (DS3Interop.IsSearchingInvasion() ^ (reoSpamCnt != 0))
                    {
                        DS3Interop.ApplyEffect(11);
                    }
                }
                hadInvaded = false;
                pingCheked = false;
            }
            if (Settings.Default.UsePingFilter)
            {
                if (status == DS3Interop.NetStatus.Host || status == DS3Interop.NetStatus.TryCreateSession || DS3Interop.InLoadingScreen())
                {   // Someone invaded, or the local player summoned a phantom, or ping filter was too late
                    pingFilterTimer.Stop();
                    reoSpamming = false;
                    reoSpamCnt  = 0;
                    pingCheked  = false;
                }
                if (status == DS3Interop.NetStatus.Client && !pingFilterTimer.IsEnabled && !pingCheked)
                {   // Connection has been established
                    pingCheked = true;
                    pingFilterTimer.Interval = TimeSpan.FromSeconds(Settings.Default.SamplingDelay);
                    pingFilterTimer.Start();
                }
            }
            else
            {
                pingFilterTimer.Stop();
            }
        }