feat: add topmost func

dev_without_third_libraries
DESKTOP-3BO4HSG\ksat 2 years ago
parent 63438cf85f
commit f0fc0397a3

@ -9,12 +9,12 @@ WPF 开发的一款即用即走的翻译工具
- [x] 优化防止多开
- [x] 添加划词翻译
- [ ] 优化 DeepL 服务并打包成库引入进项目
- [ ] 添加 OCR 翻译
- [ ] 优化划词翻译(未选中则取消翻译)
- [ ] 添加软件缓存功能
- [ ] 添加翻译记录缓存功能
- [ ] 添加 OCR 翻译
- [ ] 设置 UI 化
- [ ] 使用说明 UI 化
- [ ] 优化划词翻译(未选中则取消翻译)
- [ ] 软件层面识别语种UI 提示识别语种)
- [ ] 翻译制作成插件方式
- [ ] 优化软件发布方式(自动升级)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

@ -27,11 +27,13 @@
CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="5*" />
<RowDefinition Height="*" />
<RowDefinition Height="8*" />
<RowDefinition Height="7*" />
</Grid.RowDefinitions>
<!--托盘相关-->
<hc:NotifyIcon Text="STranslate"
IsBlink="False"
Visibility="Visible"
@ -58,9 +60,23 @@
</hc:NotifyIcon.ContextMenu>
</hc:NotifyIcon>
<!--header-->
<Grid x:Name="Header">
<Button Margin="10,0"
Cursor="Hand"
BorderBrush="Transparent"
VerticalAlignment="Top"
Click="Button_Click"
HorizontalAlignment="Left">
<Image x:Name="TopImg"
Height="20"/>
</Button>
</Grid>
<!--input-->
<Grid x:Name="Input"
Margin="10,10,10,0">
Grid.Row="1"
Margin="10,0,10,0">
<!--输入框-->
<Border x:Name="BorderInput"
Background="#f6f6f6"
@ -86,8 +102,10 @@
</TextBox>
</Border>
</Grid>
<!--mid-->
<StackPanel Grid.Row="1"
<StackPanel x:Name="MidArea"
Grid.Row="2"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Label Content="当前语言:"
@ -118,10 +136,11 @@
</hc:FloatingBlock.ContentTemplate>
</Button>
</StackPanel>
<!--output-->
<Grid Margin="10,0,10,10"
x:Name="Output"
Grid.Row="2">
<Grid x:Name="Output"
Margin="10,0,10,10"
Grid.Row="3">
<!--输出框-->
<Border x:Name="BorderOutput"
Background="#f6f6f6"

@ -4,6 +4,7 @@ using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
namespace STranslate
{
@ -17,8 +18,9 @@ namespace STranslate
public MainWindow()
{
InitializeComponent();
this.Activate();
this.TextBoxInput.Focus();
InitView();
//if (HotKeys.InputTranslate.Conflict || HotKeys.CrosswordTranslate.Conflict || HotKeys.ScreenShotTranslate.Conflict)
//{
// MessageBox.Show("全局快捷键有冲突,请您到设置中重新设置");
@ -151,9 +153,12 @@ namespace STranslate
/// <param name="sender"></param>
/// <param name="e"></param>
private void Window_Deactivated(object sender, EventArgs e)
{
if (this.TopImg.Source == UnLockImgPath)
{
this.Hide();
}
}
/// <summary>
/// 清空输入输出框
@ -200,5 +205,24 @@ namespace STranslate
{
HandyControl.Controls.MessageBox.Show("开发中");
}
/// <summary>
/// 是否置顶
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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"));
}
}

@ -90,6 +90,16 @@ namespace STranslate.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap lock2 {
get {
object obj = ResourceManager.GetObject("lock2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>
@ -110,6 +120,16 @@ namespace STranslate.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap unlock2 {
get {
object obj = ResourceManager.GetObject("unlock2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。
/// </summary>

@ -127,12 +127,18 @@
<data name="input" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\input.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="lock2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\lock2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="screenshot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\screenshot.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="translate2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\translate2.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="unlock2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\unlock2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="window" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\window.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

@ -151,6 +151,12 @@
<Resource Include="Images\window.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\lock2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\unlock2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Content Include="STranslate.yml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save