null检测
This commit is contained in:
parent
5a1180d198
commit
4103b15249
@ -21,7 +21,7 @@ namespace FastGithub.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
StartFastGithub();
|
StartFastGithub();
|
||||||
SetWebBrowserVersion(9000);
|
SetWebBrowserVersion();
|
||||||
|
|
||||||
var app = new Application();
|
var app = new Application();
|
||||||
app.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
|
app.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
|
||||||
@ -51,12 +51,18 @@ namespace FastGithub.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置浏览器版本
|
/// 设置浏览器版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="version"></param>
|
private static void SetWebBrowserVersion()
|
||||||
private static void SetWebBrowserVersion(int version)
|
|
||||||
{
|
{
|
||||||
var registry = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
|
const string subKey = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
|
||||||
var key = $"{Process.GetCurrentProcess().ProcessName}.exe";
|
var registryKey = Registry.CurrentUser.OpenSubKey(subKey, true);
|
||||||
registry.SetValue(key, version, RegistryValueKind.DWord);
|
if (registryKey == null)
|
||||||
|
{
|
||||||
|
registryKey = Registry.CurrentUser.CreateSubKey(subKey);
|
||||||
|
}
|
||||||
|
var name = $"{Process.GetCurrentProcess().ProcessName}.exe";
|
||||||
|
using var webBrowser = new System.Windows.Forms.WebBrowser();
|
||||||
|
var value = int.Parse($"{webBrowser.Version.Major}000");
|
||||||
|
registryKey.SetValue(name, value, RegistryValueKind.DWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user