feat: add handyconftrol

dev_without_third_libraries
ZGGSONG 2 years ago
parent 319087825d
commit 7a3b4a5f16

@ -4,6 +4,10 @@
xmlns:local="clr-namespace:STranslate"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:STranslate"
xmlns:vm="clr-namespace:STranslate.ViewModel"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="Transparent"
WindowStartupLocation="CenterScreen"
@ -30,6 +31,12 @@
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<hc:NotifyIcon Text="STranslate"
Click="NotifyIcon_Click"
IsBlink="False"
Visibility="Visible"
Icon="/Images/translate.ico"/>
<!--input-->
<Grid Margin="10">
<!--输入框-->
@ -45,6 +52,8 @@
FontSize="18"
MinHeight="35"
TextWrapping="Wrap"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Text="{Binding InputTxt,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBox.InputBindings>
<KeyBinding Command="{Binding TranslateCmd}" Key="Enter"/>
@ -55,7 +64,9 @@
<!--output-->
<Grid Margin="10"
Grid.Row="1">
<Label Content="翻译结果: "/>
<Label Content="翻译结果: "
VerticalAlignment="Top"
HorizontalAlignment="Left"/>
<!--输出框-->
<Border BorderBrush="#000"
@ -67,13 +78,14 @@
BorderBrush="{x:Null}"
BorderThickness="0"
IsReadOnly="True"
Margin="5"
FontSize="18"
MinHeight="35"
TextWrapping="Wrap"
Text="{Binding OutputTxt}"/>
Margin="5"
FontSize="18"
MinHeight="35"
VerticalAlignment="Top"
HorizontalAlignment="Left"
TextWrapping="Wrap"
Text="{Binding OutputTxt}"/>
</Border>
<!--<Button Content="复制"
Margin="0,0,10,0"
VerticalAlignment="Top"

@ -48,10 +48,10 @@ namespace STranslate
Topmost = Topmost != true;
Opacity = Topmost ? 1 : 0.9;
}
//最小化 Ctrl+M
//最小化 Esc
if (e.Key == Key.Escape)
{
WindowState = WindowState.Minimized;
this.Hide();
}
//退出 Ctrl+Q
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control) && e.Key == Key.Q)
@ -85,5 +85,10 @@ namespace STranslate
Height = 450;
}
}
private void NotifyIcon_Click(object sender, RoutedEventArgs e)
{
this.Show();
}
}
}

@ -17,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="HandyControls" Version="3.4.4" />
<PackageReference Include="YamlDotNet" Version="12.2.1" />
</ItemGroup>

Loading…
Cancel
Save