From 16c8baa4bc1d2b3e66db3d04c9ddcf6934cd2049 Mon Sep 17 00:00:00 2001 From: CuiLiang Date: Sat, 14 Aug 2021 22:51:35 +0800 Subject: [PATCH 1/6] Update README.md --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9ed1feb..b7d0ce4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ - 支持跟随鼠标的位置指示圆标; - 支持多屏DPI感知; - 支持开机自启动; -- 绿色单文件; 下载地址:https://github.com/cuiliang/ClickShow/releases @@ -20,17 +19,21 @@ # 使用 - 系统需求:Windows7 sp1+, .Net 4.7.2 版本(win10自带) -- 如需在任务管理器、开始菜单、以管理员身份启动的窗口上生效,请将程序(1.3.1+版本)放到C:\Windows或C:\Program Files目录下使用。这时候程序会自动提升权限。 +- 如需在任务管理器、开始菜单、以管理员身份启动的窗口上生效,请将程序(1.3.1+版本)放到 `C:\Windows` 或 `C:\Program Files` 目录下使用。这时候程序会自动提升权限。 - 程序启动后自动缩小到系统托盘。 -- 点击托盘图标打开主窗口。 -- 点击X关闭主窗口退出程序;也可以在托盘图标右键菜单退出程序。 +- 点击X最小化到系统托盘。 +- 点击托盘图标打开主窗口,右键点击托盘图标打开菜单。 -![image](https://user-images.githubusercontent.com/1972649/122925354-5554a600-d399-11eb-883c-60220fbd8da3.png) +![image](https://user-images.githubusercontent.com/1972649/129450207-45174d8b-89ad-489c-876b-a2bc657e5417.png) + ## 更新历史 +### 1.4.0 +- 增加参数设置与自动保存。感谢 @BigDevil82 贡献代码。 + ### 1.3.3 - 按下时的波纹效果避开中心一点。 From cc1b743f0354e6ce543299a59a57baae61fb5eb0 Mon Sep 17 00:00:00 2001 From: CuiLiang Date: Tue, 7 Sep 2021 22:30:28 +0800 Subject: [PATCH 2/6] Create version.txt --- version.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 version.txt diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..7594264 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.4.1.0 From 4a773bbf02aa948e7215f291f16f6e32c99cd6b2 Mon Sep 17 00:00:00 2001 From: CuiLiang Date: Tue, 7 Sep 2021 23:00:37 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix=EF=BC=9A=E7=AA=97=E5=8F=A3=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=BD=BB=E5=BA=95=E9=80=8F=E6=98=8E=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClickShow/UI/ClickIndicator.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClickShow/UI/ClickIndicator.xaml.cs b/ClickShow/UI/ClickIndicator.xaml.cs index d8c7bb8..6314641 100644 --- a/ClickShow/UI/ClickIndicator.xaml.cs +++ b/ClickShow/UI/ClickIndicator.xaml.cs @@ -34,7 +34,7 @@ public ClickIndicator(double size) this.Width = size; this.Height = size; - //SourceInitialized += OnSourceInitialized; + SourceInitialized += OnSourceInitialized; DpiChanged += OnDpiChanged; RenderOptions.SetBitmapScalingMode(TheCircle, BitmapScalingMode.LowQuality); From b5ad72358642c21f77b699cb4c4a46c6cd9ac8be Mon Sep 17 00:00:00 2001 From: CuiLiang Date: Tue, 7 Sep 2021 23:01:32 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=87=86=E5=A4=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A3=80=E6=9F=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClickShow/Settings/AppSetting.cs | 5 +++ ClickShow/UI/MainWindow.xaml.cs | 63 ++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/ClickShow/Settings/AppSetting.cs b/ClickShow/Settings/AppSetting.cs index 72b9588..5a80cd7 100644 --- a/ClickShow/Settings/AppSetting.cs +++ b/ClickShow/Settings/AppSetting.cs @@ -114,5 +114,10 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + + /// + /// 上次提醒的版本 + /// + public string LastNotifiedVersion { get; set; } } } diff --git a/ClickShow/UI/MainWindow.xaml.cs b/ClickShow/UI/MainWindow.xaml.cs index 2f3f523..70e6b4e 100644 --- a/ClickShow/UI/MainWindow.xaml.cs +++ b/ClickShow/UI/MainWindow.xaml.cs @@ -4,8 +4,10 @@ using System.Diagnostics; using System.IO; using System.Linq; +using System.Net; using System.Reflection; using System.Runtime.InteropServices; +using System.Threading.Tasks; using System.Windows; using System.Windows.Forms; using System.Windows.Interop; @@ -96,6 +98,67 @@ private void OnLoaded(object sender, RoutedEventArgs e) _mouseHook.MouseMove += MouseHookOnMouseMove; _mouseHook.MouseUp += MouseHookOnMouseUp; _mouseHook.Start(); + + // 检查版本更新 + Task.Run(async () => + { + await Task.Delay(1000 * 60 * 1); + CheckUpdate(); + }); + + } + + /// + /// 在主窗口上提示有新版本 + /// + public bool ShowNewVersionTip { get; set; } + public Version NewVersion { get; set; } + + /// + /// 检查版本更新 + /// + private void CheckUpdate() + { + string url = "https://raw.githubusercontent.com/cuiliang/ClickShow/main/version.txt"; + + try + { + var client = new WebClient(); + var versionStr = client.DownloadString(url); + NewVersion = new Version(versionStr); + + // 版本落后了 + if (NewVersion > Assembly.GetExecutingAssembly().GetName().Version) + { + // 如果之前已经提示了此版本,则不再提示,不然每次开机都会有一个提示了。 + if (String.Equals(AppSetting.LastNotifiedVersion, versionStr)) + { + ShowNewVersionTip = true; + } + else + { + AppSetting.LastNotifiedVersion = versionStr; + SaveSettings(); + + if (MessageBox.Show($"ClickShow有新版本({versionStr}),是否立即打开网页?", "ClickShow", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) + { + try + { + Process.Start("https://github.com/cuiliang/ClickShow/releases"); + } + catch + { + MessageBox.Show("无法打开网址:https://github.com/cuiliang/ClickShow/releases"); + } + } + } + } + } + catch (Exception ex) + { + // ignore error + } + } /// From f55d30e4973678f3d413a219985ca0aba9636418 Mon Sep 17 00:00:00 2001 From: cuiliang Date: Wed, 8 Sep 2021 08:23:34 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=94=B9=E5=96=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ClickShow/Properties/AssemblyInfo.cs | 4 +-- ClickShow/Settings/AppSetting.cs | 2 +- ClickShow/UI/MainWindow.xaml | 5 ++- ClickShow/UI/MainWindow.xaml.cs | 52 +++++++++++++++++++--------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/ClickShow/Properties/AssemblyInfo.cs b/ClickShow/Properties/AssemblyInfo.cs index 09c82e2..3148e76 100644 --- a/ClickShow/Properties/AssemblyInfo.cs +++ b/ClickShow/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.4.1.0")] +[assembly: AssemblyFileVersion("1.4.1.0")] diff --git a/ClickShow/Settings/AppSetting.cs b/ClickShow/Settings/AppSetting.cs index 5a80cd7..2287aeb 100644 --- a/ClickShow/Settings/AppSetting.cs +++ b/ClickShow/Settings/AppSetting.cs @@ -116,7 +116,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName } /// - /// 上次提醒的版本 + /// 上次提醒的最新版本,避免重复提醒。 /// public string LastNotifiedVersion { get; set; } } diff --git a/ClickShow/UI/MainWindow.xaml b/ClickShow/UI/MainWindow.xaml index 01b5494..3462dc8 100644 --- a/ClickShow/UI/MainWindow.xaml +++ b/ClickShow/UI/MainWindow.xaml @@ -60,8 +60,11 @@ - 反馈与更新 / Homepage + 反馈与更新 / Homepage + + + diff --git a/ClickShow/UI/MainWindow.xaml.cs b/ClickShow/UI/MainWindow.xaml.cs index 70e6b4e..3f1f3a9 100644 --- a/ClickShow/UI/MainWindow.xaml.cs +++ b/ClickShow/UI/MainWindow.xaml.cs @@ -102,16 +102,12 @@ private void OnLoaded(object sender, RoutedEventArgs e) // 检查版本更新 Task.Run(async () => { - await Task.Delay(1000 * 60 * 1); + await Task.Delay(1000 * 10 ); CheckUpdate(); }); } - /// - /// 在主窗口上提示有新版本 - /// - public bool ShowNewVersionTip { get; set; } public Version NewVersion { get; set; } /// @@ -119,13 +115,30 @@ private void OnLoaded(object sender, RoutedEventArgs e) /// private void CheckUpdate() { - string url = "https://raw.githubusercontent.com/cuiliang/ClickShow/main/version.txt"; + // 版本号检查网址 + string url = "https://helperservice.getquicker.cn/clickshow/version"; + string updateUrl = "https://github.com/cuiliang/ClickShow/releases"; try { var client = new WebClient(); + + // 下载版本信息字符串。可能格式:(1)只有版本号。 (2)版本号|网址 var versionStr = client.DownloadString(url); - NewVersion = new Version(versionStr); + + if (versionStr.Contains("|")) + { + string[] parts = versionStr.Split('|'); + NewVersion = new Version(parts[0]); + updateUrl = String.IsNullOrEmpty(parts[1]) ? updateUrl : parts[1]; + } + else + { + NewVersion = new Version(versionStr); + } + + + // 版本落后了 if (NewVersion > Assembly.GetExecutingAssembly().GetName().Version) @@ -133,23 +146,28 @@ private void CheckUpdate() // 如果之前已经提示了此版本,则不再提示,不然每次开机都会有一个提示了。 if (String.Equals(AppSetting.LastNotifiedVersion, versionStr)) { - ShowNewVersionTip = true; + Dispatcher.InvokeAsync(() => + { + LblNewVersion.Visibility = Visibility.Visible; + + }); } else { AppSetting.LastNotifiedVersion = versionStr; SaveSettings(); - if (MessageBox.Show($"ClickShow有新版本({versionStr}),是否立即打开网页?", "ClickShow", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) + if (MessageBox.Show($"ClickShow有新版本({versionStr}),是否立即打开网页?", "ClickShow", MessageBoxButton.YesNo, MessageBoxImage.Information) != MessageBoxResult.Yes) + { + return; + } + try + { + Process.Start(updateUrl); + } + catch { - try - { - Process.Start("https://github.com/cuiliang/ClickShow/releases"); - } - catch - { - MessageBox.Show("无法打开网址:https://github.com/cuiliang/ClickShow/releases"); - } + MessageBox.Show($"无法打开网址:{updateUrl}"); } } } From f20c4a153616d0cb87ef7420d722c3ce497e37b6 Mon Sep 17 00:00:00 2001 From: CuiLiang Date: Wed, 8 Sep 2021 08:32:58 +0800 Subject: [PATCH 6/6] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b7d0ce4..500d5a0 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,11 @@ ## 更新历史 + +### 1.4.1 +- 修复鼠标穿透问题。 +- 启动后检查版本更新。 + ### 1.4.0 - 增加参数设置与自动保存。感谢 @BigDevil82 贡献代码。