chore: update tray and readme

dev_self 0.15
DESKTOP-3BO4HSG\ksat 2 years ago
parent 0923ccf415
commit ca3d75a4fc

@ -34,7 +34,7 @@
- [x] 添加亮/暗主题
- [x] 添加 UI 设置缓存(用户目录下 `AppData\Local\STranslate`)
- [x] 添加语音合成
- [ ] 添加 OCR 翻译
- [x] 添加离线截图翻译
- [ ] 添加翻译记录缓存功能
## 使用
@ -47,6 +47,7 @@
1. 全局监听快捷键
- `Alt` + `A` 打开软件界面,输入内容按回车翻译
- `Alt` + `D` 复制当前鼠标选中内容并翻译
- `Alt` + `S` 截图选中区域内容并翻译
- `Alt` + `G` 打开窗口(不清空内容)
2. 软件内快捷键
@ -60,6 +61,38 @@
![previews](./example_tray.png)
4. 0.15 添加离线 OCR 功能,其使用 [tesseract](https://github.com/tesseract-ocr/tesseract) 目前仅支持英文
<details>
<summary>自修改提示</summary>
有经验者可自行下载 [语言包](https://github.com/tesseract-ocr/tessdata) 至 `tessdata` 目录后修改 `Util`中`TesseractGetText`方法即可
```C#
public static string TesseractGetText(Bitmap bmp)
{
try
{
using (var engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default))
//using (var engine = new TesseractEngine(@"./tessdata", "chi_sim", EngineMode.Default))
{
using(var pix = PixConverter.ToPix(bmp))
{
using (var page = engine.Process(pix))
{
return page.GetText();
}
}
}
}
catch (Exception ex)
{
throw ex;
}
}
```
</details>
## 接口失效
若远端接口均失效,需要自己本地运行翻译服务(感谢[zu1k](https://github.com/zu1k)),根据自己的系统 [下载可执行文件](https://github.com/zu1k/removed-2022-07-12/releases/tag/0.1.2) 自己的版本,软件右上角选择 `local` 接口即可

@ -47,6 +47,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.4.0")]
[assembly: AssemblyFileVersion("0.1.4.0")]
[assembly: AssemblyVersion("0.1.5.0")]
[assembly: AssemblyFileVersion("0.1.5.0")]
[assembly: Guid("CE252DD8-179F-4544-9989-453F5DEA378D")]

@ -23,11 +23,16 @@
<Window.Resources>
<ContextMenu x:Key="TrayMenu">
<MenuItem Header="输入翻译"
InputGestureText="Alt+A"
Command="{Binding InputTranslateCmd}"/>
<MenuItem Header="截图翻译"
InputGestureText="Alt+S"
Command="{Binding ScreenShotTranslateCmd}"/>
<Separator />
<MenuItem Header="划词翻译"
InputGestureText="Alt+D"
IsEnabled="False"/>
<MenuItem Header="显示主界面"
InputGestureText="Alt+G"
Command="{Binding ShowMainWinCmd}"/>
<MenuItem Header="开机自启"
IsChecked="{Binding IsStartup}"
@ -64,15 +69,15 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="5*" />
<RowDefinition Height="5*"/>
<RowDefinition Height="*" />
<RowDefinition Height="7*" />
<RowDefinition Height="7*"/>
</Grid.RowDefinitions>
<!--tray-->
<tb:TaskbarIcon x:Name="myNotifyIcon"
Visibility="{Binding IsVisibility, Converter={StaticResource BooleanToVisibilityConverter}}"
ToolTipText="STranslate"
ToolTipText="{Binding TrayToolTip}"
ContextMenu="{StaticResource TrayMenu}"
DoubleClickCommand="{Binding InputTranslateCmd}"
IconSource="/Images/translate.ico"/>

@ -16,13 +16,17 @@ namespace STranslate.ViewModel
{
public MainVM()
{
#region Initial
if (!ReadConfig())
{
ExitApp(-1);
}
TrayToolTip = $"{System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)} " +
$"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
InputCombo = LanguageEnumDict.Keys.ToList();
OutputCombo = LanguageEnumDict.Keys.ToList();
#endregion
#region 托盘程序
//运行前检查是否开机自启
@ -434,6 +438,12 @@ namespace STranslate.ViewModel
public ICommand EscCmd { get; private set; }
public ICommand SelectLangChangedCmd { get; private set; }
/// <summary>
/// 托盘程序ToolTip
/// </summary>
private string _TrayToolTip;
public string TrayToolTip { get => _TrayToolTip; set => UpdateProperty(ref _TrayToolTip, value); }
/// <summary>
/// 是否开机自启
/// </summary>

Loading…
Cancel
Save