diff --git a/README.md b/README.md index 6591bab..8fc93c8 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ WPF 开发的一款即用即走的翻译工具 - [x] 优化防止多开 - [x] 添加划词翻译 - [ ] 优化 DeepL 服务并打包成库引入进项目 +- [ ] 添加 OCR 翻译 +- [ ] 优化划词翻译(未选中则取消翻译) - [ ] 添加软件缓存功能 - [ ] 添加翻译记录缓存功能 -- [ ] 添加 OCR 翻译 - [ ] 设置 UI 化 - [ ] 使用说明 UI 化 -- [ ] 优化划词翻译(未选中则取消翻译) - [ ] 软件层面识别语种(UI 提示识别语种) - [ ] 翻译制作成插件方式 - [ ] 优化软件发布方式(自动升级) diff --git a/STranslate/Images/lock2.png b/STranslate/Images/lock2.png new file mode 100644 index 0000000..bd9a1c8 Binary files /dev/null and b/STranslate/Images/lock2.png differ diff --git a/STranslate/Images/unlock2.png b/STranslate/Images/unlock2.png new file mode 100644 index 0000000..36649e2 Binary files /dev/null and b/STranslate/Images/unlock2.png differ diff --git a/STranslate/MainWindow.xaml b/STranslate/MainWindow.xaml index c070977..e677919 100644 --- a/STranslate/MainWindow.xaml +++ b/STranslate/MainWindow.xaml @@ -27,11 +27,13 @@ CornerRadius="10"> + - + + + + + + + + Grid.Row="1" + Margin="10,0,10,0"> + - + - + private void Window_Deactivated(object sender, EventArgs e) { - this.Hide(); + if (this.TopImg.Source == UnLockImgPath) + { + this.Hide(); + } } /// @@ -200,5 +205,24 @@ namespace STranslate { HandyControl.Controls.MessageBox.Show("开发中"); } + + /// + /// 是否置顶 + /// + /// + /// + private void Button_Click(object sender, RoutedEventArgs e) + { + this.TopImg.Source = TopImg.Source == LockImgPath ? UnLockImgPath : LockImgPath; + } + private void InitView() + { + this.TopImg.Source = UnLockImgPath; + + this.Activate(); + this.TextBoxInput.Focus(); + } + private BitmapImage LockImgPath = new BitmapImage(new Uri("pack://application:,,,/Images/lock2.png")); + private BitmapImage UnLockImgPath = new BitmapImage(new Uri("pack://application:,,,/Images/unlock2.png")); } } \ No newline at end of file diff --git a/STranslate/Properties/Resources.Designer.cs b/STranslate/Properties/Resources.Designer.cs index 0224332..2069961 100644 --- a/STranslate/Properties/Resources.Designer.cs +++ b/STranslate/Properties/Resources.Designer.cs @@ -90,6 +90,16 @@ namespace STranslate.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap lock2 { + get { + object obj = ResourceManager.GetObject("lock2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 /// @@ -110,6 +120,16 @@ namespace STranslate.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap unlock2 { + get { + object obj = ResourceManager.GetObject("unlock2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 /// diff --git a/STranslate/Properties/Resources.resx b/STranslate/Properties/Resources.resx index ee880f5..451f5cd 100644 --- a/STranslate/Properties/Resources.resx +++ b/STranslate/Properties/Resources.resx @@ -127,12 +127,18 @@ ..\images\input.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\images\lock2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\screenshot.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\images\translate2.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\images\unlock2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\images\window.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj index c49f38a..b30e59b 100644 --- a/STranslate/STranslate.csproj +++ b/STranslate/STranslate.csproj @@ -151,6 +151,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest