diff --git a/FastGithub.UI/App.xaml.cs b/FastGithub.UI/App.xaml.cs index 24deb27..b519576 100644 --- a/FastGithub.UI/App.xaml.cs +++ b/FastGithub.UI/App.xaml.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using Microsoft.Win32; +using System.Diagnostics; using System.IO; using System.Threading; using System.Windows; @@ -22,7 +23,8 @@ namespace FastGithub.UI return; } - this.fastGithub = StartFastGithub(); + this.fastGithub = StartFastGithub(); + SetWebBrowserVersion(); base.OnStartup(e); } @@ -51,6 +53,13 @@ namespace FastGithub.UI CreateNoWindow = true }; return Process.Start(startInfo); - } + } + + private static void SetWebBrowserVersion() + { + var emulation = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true); + var key = $"{Process.GetCurrentProcess().ProcessName}.exe"; + emulation.SetValue(key, 9000, RegistryValueKind.DWord); + } } } diff --git a/FastGithub.UI/FastGithub.UI.csproj b/FastGithub.UI/FastGithub.UI.csproj index f2842fe..57d94cc 100644 --- a/FastGithub.UI/FastGithub.UI.csproj +++ b/FastGithub.UI/FastGithub.UI.csproj @@ -126,7 +126,10 @@ - + + + + \ No newline at end of file diff --git a/FastGithub.UI/MainWindow.xaml b/FastGithub.UI/MainWindow.xaml index 14572a2..0f77195 100644 --- a/FastGithub.UI/MainWindow.xaml +++ b/FastGithub.UI/MainWindow.xaml @@ -145,20 +145,20 @@ - - + + - - + + - - + + diff --git a/FastGithub.UI/MainWindow.xaml.cs b/FastGithub.UI/MainWindow.xaml.cs index 6e28001..63bab33 100644 --- a/FastGithub.UI/MainWindow.xaml.cs +++ b/FastGithub.UI/MainWindow.xaml.cs @@ -1,10 +1,8 @@ using System; using System.Diagnostics; using System.IO; -using System.Net.Http; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Forms; +using System.Windows.Input; using System.Windows.Interop; namespace FastGithub.UI @@ -14,7 +12,7 @@ namespace FastGithub.UI /// public partial class MainWindow : Window { - private NotifyIcon notifyIcon; + private System.Windows.Forms.NotifyIcon notifyIcon; private const string FAST_GITHUB = "FastGithub"; private const string PROJECT_URI = "https://github.com/dotnetcore/FastGithub"; @@ -22,23 +20,23 @@ namespace FastGithub.UI { InitializeComponent(); - var about = new MenuItem("关于(&A)"); + var about = new System.Windows.Forms.MenuItem("关于(&A)"); about.Click += (s, e) => Process.Start(PROJECT_URI); - var exit = new MenuItem("退出(&C)"); + var exit = new System.Windows.Forms.MenuItem("退出(&C)"); exit.Click += (s, e) => this.Close(); - this.notifyIcon = new NotifyIcon + this.notifyIcon = new System.Windows.Forms.NotifyIcon { Visible = true, Text = FAST_GITHUB, - ContextMenu = new ContextMenu(new[] { about, exit }), + ContextMenu = new System.Windows.Forms.ContextMenu(new[] { about, exit }), Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath) }; this.notifyIcon.MouseClick += (s, e) => { - if (e.Button == MouseButtons.Left) + if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.Show(); this.Activate(); @@ -51,7 +49,22 @@ namespace FastGithub.UI { var version = FileVersionInfo.GetVersionInfo(fileName); this.Title = $"{FAST_GITHUB} v{version.ProductVersion}"; - } + } + + + this.webCert.AddHandler(KeyDownEvent, new RoutedEventHandler(WebBrowser_KeyDown), true); + var resource = Application.GetResourceStream(new Uri("Resource/cert.html", UriKind.Relative)); + this.webCert.NavigateToStream(resource.Stream); + } + + private void WebBrowser_KeyDown(object sender, RoutedEventArgs e) + { + var @event = (KeyEventArgs)e; + if (@event.Key == Key.F5) + { + var resource = Application.GetResourceStream(new Uri("Resource/cert.html", UriKind.Relative)); + this.webCert.NavigateToStream(resource.Stream); + } } protected override void OnSourceInitialized(EventArgs e) diff --git a/FastGithub.UI/Resource/cert.html b/FastGithub.UI/Resource/cert.html new file mode 100644 index 0000000..20abb57 --- /dev/null +++ b/FastGithub.UI/Resource/cert.html @@ -0,0 +1,87 @@ + + + + + + + + 证书验证 + + + + +
+
+

Firefox

+
+

建立安全连接失败

+

连接到 github.com 时发生错误。对等端的证书有一个无效的签名。

+

错误代码:SEC_ERROR_BAD_SIGNATURE

+
+ +

解决办法

+

+ 1 + 地址栏输入:about:config +

+

+ 2 + 输入首选项名称:security.enterprise_roots.enabled +

+

+ 3 + 修改值为:true +

+
+
+
+

git.exe

+
+

clone、pull或push等异常

+

fatal: unable to access 'https://github.com/xxx.git/'

+

SSL certificate problem: unable to get local issuer certificate

+
+ +

解决办法

+

+ 1 + 管理员身份运行:cmd +

+

+ 2 + 在cmd输入:git config --global http.sslverify false +

+
+
+ + + + + \ No newline at end of file diff --git a/FastGithub.UI/Images/reward.png b/FastGithub.UI/Resource/reward.png similarity index 100% rename from FastGithub.UI/Images/reward.png rename to FastGithub.UI/Resource/reward.png