public TabSettingsAdvanced(Action <string> reinjectBrowserCSS) { InitializeComponent(); this.reinjectBrowserCSS = reinjectBrowserCSS; if (SystemConfig.IsHardwareAccelerationSupported) { checkHardwareAcceleration.Checked = SysConfig.HardwareAcceleration; } else { checkHardwareAcceleration.Enabled = false; checkHardwareAcceleration.Checked = false; } checkBrowserGCReload.Checked = SysConfig.EnableBrowserGCReload; numMemoryThreshold.Enabled = checkBrowserGCReload.Checked; numMemoryThreshold.SetValueSafe(SysConfig.BrowserMemoryThreshold); BrowserCache.CalculateCacheSize(task => { string text = task.IsCompleted ? (int)Math.Ceiling(task.Result / (1024.0 * 1024.0)) + " MB" : "(unknown size)"; this.InvokeSafe(() => btnClearCache.Text = $"Clear Cache ({text})"); }); }
public TabSettingsAdvanced(Action <string> reinjectBrowserCSS, PluginManager plugins) { InitializeComponent(); this.reinjectBrowserCSS = reinjectBrowserCSS; this.plugins = plugins; checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled; BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => { if (bytes == -1L) { btnClearCache.Text = "Clear Cache (unknown size)"; } else { btnClearCache.Text = "Clear Cache (" + (int)Math.Ceiling(bytes / (1024.0 * 1024.0)) + " MB)"; } })); }