private static void SelectThrottleSettings(SpeedTestResult result) { if (result == null || result.Error != null) { ThrottleSettings.Default.EnableDynamicImageQuality = true; ThrottleSettings.Default.MaxPendingMouseMoveMsgAllowed = 1; return; } // These speeds are picked based on experiments. if (result.SpeedInMbps >= 150) { // the connection is fast enough ThrottleSettings.Default.EnableDynamicImageQuality = false; ThrottleSettings.Default.MaxPendingMouseMoveMsgAllowed = 4; } else if (result.SpeedInMbps >= 10) { // the connection is fast enough ThrottleSettings.Default.EnableDynamicImageQuality = false; ThrottleSettings.Default.MaxPendingMouseMoveMsgAllowed = 3; } else if (result.SpeedInMbps >= 2) { ThrottleSettings.Default.EnableDynamicImageQuality = true; ThrottleSettings.Default.MaxPendingMouseMoveMsgAllowed = 2; } else { ThrottleSettings.Default.EnableDynamicImageQuality = true; ThrottleSettings.Default.MaxPendingMouseMoveMsgAllowed = 1; } }