private void ApplicationFocusWatcher_ApplicationFocusChanged(object sender, ApplicationFocusChangedEventArgs e) { var isPointerAccelerationOn = SystemPointerHelper.GetEnhancePointerPrecision(); var isMatch = _watchedExecutions.Any(x => string.Equals(x.Path, e.ProcessExecutionPath, StringComparison.InvariantCultureIgnoreCase)); if (isMatch && isPointerAccelerationOn) { SystemPointerHelper.SetEnhancePointerPrecision(false); ToastNotificationHelper.Show("Starting Game Mode", "Mouse acceleration turned off."); } else if (!isMatch && !isPointerAccelerationOn) { SystemPointerHelper.SetEnhancePointerPrecision(true); ToastNotificationHelper.Show("Stopping Game Mode", "Mouse acceleration turned on."); } }
private void OnApplicationFocusChanged(int oldProcessId, int newProcessId) { if (ApplicationFocusChanged == null || oldProcessId == newProcessId) { return; } var args = new ApplicationFocusChangedEventArgs(newProcessId); try { args = new ApplicationFocusChangedEventArgs(newProcessId, ProcessHelper.GetExecutionPath(newProcessId)); } catch (Exception ex) { Debug.WriteLine($"{ex.GetType().Name}, {ex.Message}"); } finally { ApplicationFocusChanged(this, args); } }