Skip to content
This repository was archived by the owner on Apr 8, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ClickShow/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
5 changes: 5 additions & 0 deletions ClickShow/Settings/AppSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,10 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

/// <summary>
/// 上次提醒的最新版本,避免重复提醒。
/// </summary>
public string LastNotifiedVersion { get; set; }
}
}
2 changes: 1 addition & 1 deletion ClickShow/UI/ClickIndicator.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion ClickShow/UI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Margin="10" HorizontalAlignment="Center">
<Hyperlink NavigateUri="https://github.com/cuiliang/clickshow" RequestNavigate="HyperlinkOpenHomepage_OnRequestNavigate">反馈与更新 / Homepage</Hyperlink>
<Hyperlink NavigateUri="https://github.com/cuiliang/clickshow" RequestNavigate="HyperlinkOpenHomepage_OnRequestNavigate">反馈与更新 / Homepage</Hyperlink>
<LineBreak></LineBreak>
<TextBlock Name="LblNewVersion" Foreground="OrangeRed" FontWeight="Bold" Visibility="Collapsed" Text="已有新版本!"/>
</TextBlock>


<Grid>
<Grid.ColumnDefinitions>
Expand Down
81 changes: 81 additions & 0 deletions ClickShow/UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -96,6 +98,85 @@ private void OnLoaded(object sender, RoutedEventArgs e)
_mouseHook.MouseMove += MouseHookOnMouseMove;
_mouseHook.MouseUp += MouseHookOnMouseUp;
_mouseHook.Start();

// 检查版本更新
Task.Run(async () =>
{
await Task.Delay(1000 * 10 );
CheckUpdate();
});

}

public Version NewVersion { get; set; }

/// <summary>
/// 检查版本更新
/// </summary>
private void CheckUpdate()
{
// 版本号检查网址
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);

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)
{
// 如果之前已经提示了此版本,则不再提示,不然每次开机都会有一个提示了。
if (String.Equals(AppSetting.LastNotifiedVersion, versionStr))
{
Dispatcher.InvokeAsync(() =>
{
LblNewVersion.Visibility = Visibility.Visible;

});
}
else
{
AppSetting.LastNotifiedVersion = versionStr;
SaveSettings();

if (MessageBox.Show($"ClickShow有新版本({versionStr}),是否立即打开网页?", "ClickShow", MessageBoxButton.YesNo, MessageBoxImage.Information) != MessageBoxResult.Yes)
{
return;
}
try
{
Process.Start(updateUrl);
}
catch
{
MessageBox.Show($"无法打开网址:{updateUrl}");
}
}
}
}
catch (Exception ex)
{
// ignore error
}

}

/// <summary>
Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- 支持跟随鼠标的位置指示圆标;
- 支持多屏DPI感知;
- 支持开机自启动;
- 绿色单文件;


下载地址:https://github.com/cuiliang/ClickShow/releases
Expand All @@ -20,17 +19,26 @@

# 使用
- 系统需求: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.1
- 修复鼠标穿透问题。
- 启动后检查版本更新。

### 1.4.0
- 增加参数设置与自动保存。感谢 @BigDevil82 贡献代码。

### 1.3.3
- 按下时的波纹效果避开中心一点。

Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.4.1.0