private void tmrUpdate_Tick(object sender, EventArgs e) { _UpdateTick += tmrUpdate.Interval / 1000; if (_UpdateTick >= UpdateInterval) { _UpdateTick = 0; lblRefreshStatus.Text = "Updating..."; Refresh(); UpdateGames(); LASTINPUTINFO lii = new LASTINPUTINFO(); lii.cbSize = Marshal.SizeOf(lii); Utility.GetLastInputInfo(out lii); try { Program.BotClient.SetIdleTime((Environment.TickCount - lii.dwTime) / 1000); } catch (Exception) { /* Do nothing. */ } } lblRefreshStatus.Text = string.Format("Next update in {0} seconds", UpdateInterval - _UpdateTick); }
public static extern bool GetLastInputInfo(out LASTINPUTINFO plii);