|
|
|
<Window x:Class="STranslate.MainWindow"
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
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"
|
|
|
|
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
|
|
|
AllowsTransparency="True"
|
|
|
|
ShowInTaskbar="False"
|
|
|
|
ResizeMode="NoResize"
|
|
|
|
KeyDown="Window_KeyDown"
|
|
|
|
Topmost="True"
|
|
|
|
Deactivated="Window_Deactivated"
|
|
|
|
WindowStyle="None"
|
|
|
|
Height="450"
|
|
|
|
Width="400"
|
|
|
|
Icon="/Images/translate.ico">
|
|
|
|
<Window.DataContext>
|
|
|
|
<vm:MainVM/>
|
|
|
|
</Window.DataContext>
|
|
|
|
<Border BorderThickness="0"
|
|
|
|
Background="BlanchedAlmond"
|
|
|
|
CornerRadius="10">
|
|
|
|
<Grid>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="5*"/>
|
|
|
|
<RowDefinition Height="*"/>
|
|
|
|
<RowDefinition Height="8*"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
<hc:NotifyIcon Text="STranslate"
|
|
|
|
Click="NotifyIcon_Click"
|
|
|
|
IsBlink="False"
|
|
|
|
Visibility="Visible"
|
|
|
|
Icon="/Images/translate.ico"/>
|
|
|
|
|
|
|
|
<!--input-->
|
|
|
|
<Grid x:Name="Input"
|
|
|
|
Margin="10,10,10,0">
|
|
|
|
<!--输入框-->
|
|
|
|
<Border x:Name="BorderInput" BorderBrush="#000"
|
|
|
|
BorderThickness="1"
|
|
|
|
CornerRadius="4"
|
|
|
|
Margin="5"
|
|
|
|
Height="{Binding ElementName=Input, Path=Height}">
|
|
|
|
<TextBox x:Name="TextBoxInput"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderBrush="{x:Null}"
|
|
|
|
Margin="5"
|
|
|
|
BorderThickness="0"
|
|
|
|
FontSize="18"
|
|
|
|
Width="{Binding ElementName=BorderInput, Path=ActualWidth}"
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
VerticalAlignment="Top"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
AcceptsReturn="True"
|
|
|
|
Text="{Binding InputTxt,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
|
|
|
|
<TextBox.InputBindings>
|
|
|
|
<KeyBinding Command="{Binding TranslateCmd}" Key="Enter"/>
|
|
|
|
</TextBox.InputBindings>
|
|
|
|
</TextBox>
|
|
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
<!--mid-->
|
|
|
|
<StackPanel Grid.Row="1"
|
|
|
|
Margin="10,0,10,0"
|
|
|
|
Orientation="Horizontal">
|
|
|
|
<Label Content="翻译结果: "
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
HorizontalAlignment="Left"/>
|
|
|
|
<Label Content="当前语言:"
|
|
|
|
Margin="10,0,0,0"/>
|
|
|
|
<ComboBox x:Name="InCombo"
|
|
|
|
Style="{StaticResource ComboBoxBaseStyle}"
|
|
|
|
ItemsSource="{Binding InputCombo}"
|
|
|
|
SelectedItem="{Binding InputComboSelected}"/>
|
|
|
|
<Label Content="目标语言:"/>
|
|
|
|
<ComboBox x:Name="OutCombo"
|
|
|
|
Style="{StaticResource ComboBoxBaseStyle}"
|
|
|
|
ItemsSource="{Binding OutputCombo}"
|
|
|
|
SelectedItem="{Binding OutputComboSelected}"/>
|
|
|
|
</StackPanel>
|
|
|
|
<!--output-->
|
|
|
|
<Grid Margin="10,0,10,10"
|
|
|
|
x:Name="Output"
|
|
|
|
Grid.Row="2">
|
|
|
|
<!--输出框-->
|
|
|
|
<Border x:Name="BorderOutput"
|
|
|
|
BorderBrush="#000"
|
|
|
|
BorderThickness="1"
|
|
|
|
CornerRadius="4"
|
|
|
|
Margin="5"
|
|
|
|
Height="{Binding ElementName=Output, Path=Height}">
|
|
|
|
<TextBox x:Name="TextBoxOutput"
|
|
|
|
Background="Transparent"
|
|
|
|
BorderBrush="{x:Null}"
|
|
|
|
BorderThickness="0"
|
|
|
|
IsReadOnly="True"
|
|
|
|
Margin="5"
|
|
|
|
FontSize="18"
|
|
|
|
Width="{Binding ElementName=BorderOutput, Path=ActualWidth}"
|
|
|
|
Height="{Binding ElementName=BorderOutput, Path=Height}"
|
|
|
|
VerticalAlignment="Top"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
Text="{Binding OutputTxt}"/>
|
|
|
|
</Border>
|
|
|
|
<!--<Button Content="复制"
|
|
|
|
Margin="0,0,10,0"
|
|
|
|
VerticalAlignment="Top"
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
Height="20"
|
|
|
|
Width="30">
|
|
|
|
<Button.Style>
|
|
|
|
<Style TargetType="Button">
|
|
|
|
<Setter Property="Background">
|
|
|
|
<Setter.Value>
|
|
|
|
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
|
|
|
<GradientStop Color="#C0C0C0" Offset="0"/>
|
|
|
|
<GradientStop Color="#787878" Offset="1"/>
|
|
|
|
</LinearGradientBrush>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
<<Style.Triggers>
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
|
|
<Setter Property="Background">
|
|
|
|
<Setter.Value>
|
|
|
|
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
|
|
|
|
<GradientStop Color="LightGray" Offset="0"/>
|
|
|
|
<GradientStop Color="Gray" Offset="1"/>
|
|
|
|
</LinearGradientBrush>
|
|
|
|
</Setter.Value>
|
|
|
|
</Setter>
|
|
|
|
</Trigger>
|
|
|
|
</Style.Triggers>
|
|
|
|
</Style>
|
|
|
|
</Button.Style>
|
|
|
|
<Button.Template>
|
|
|
|
<ControlTemplate TargetType="Button">
|
|
|
|
<Border BorderThickness="1" CornerRadius="4" Background="{TemplateBinding Background}">
|
|
|
|
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
|
|
|
</Border>
|
|
|
|
</ControlTemplate>
|
|
|
|
</Button.Template>
|
|
|
|
</Button>-->
|
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
</Border>
|
|
|
|
</Window>
|