You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
8.0 KiB
173 lines
8.0 KiB
<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="#fff"
|
|
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"
|
|
Background="#f6f6f6"
|
|
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"
|
|
HorizontalAlignment="Center"
|
|
Orientation="Horizontal">
|
|
<Label Content="当前语言:"
|
|
Background="Transparent"
|
|
BorderThickness="0"/>
|
|
<ComboBox x:Name="InCombo"
|
|
Background="#f6f6f6"
|
|
Style="{StaticResource ComboBox.Small}"
|
|
ItemsSource="{Binding InputCombo}"
|
|
SelectedItem="{Binding InputComboSelected}"/>
|
|
<Label Content="目标语言:"
|
|
Margin="10,0"
|
|
Background="Transparent"
|
|
BorderThickness="0"/>
|
|
<ComboBox x:Name="OutCombo"
|
|
Background="#f6f6f6"
|
|
Style="{StaticResource ComboBox.Small}"
|
|
ItemsSource="{Binding OutputCombo}"
|
|
SelectedItem="{Binding OutputComboSelected}"/>
|
|
<Button Margin="10,0,0,0"
|
|
Cursor="Hand"
|
|
Command="{Binding CopyTranslateResultCmd}">
|
|
<Image Source="/Images/copy.png"/>
|
|
<hc:FloatingBlock.ContentTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="复制成功"/>
|
|
</DataTemplate>
|
|
</hc:FloatingBlock.ContentTemplate>
|
|
</Button>
|
|
</StackPanel>
|
|
<!--output-->
|
|
<Grid Margin="10,0,10,10"
|
|
x:Name="Output"
|
|
Grid.Row="2">
|
|
<!--输出框-->
|
|
<Border x:Name="BorderOutput"
|
|
Background="#f6f6f6"
|
|
BorderBrush="#000"
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Margin="5"
|
|
Height="{Binding ElementName=Output, Path=Height}">
|
|
<hc:TextBox x:Name="TextBoxOutput"
|
|
hc:InfoElement.Placeholder="翻译"
|
|
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>
|