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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

184 lines
8.6 KiB

2 years ago
<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"
2 years ago
mc:Ignorable="d"
Background="Transparent"
WindowStartupLocation="CenterScreen"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
AllowsTransparency="True"
2 years ago
ShowInTaskbar="False"
2 years ago
ResizeMode="NoResize"
KeyDown="Window_KeyDown"
Topmost="True"
Deactivated="Window_Deactivated"
2 years ago
WindowStyle="None"
Height="450"
Width="400"
2 years ago
Icon="/Images/translate2.ico">
2 years ago
<Border BorderThickness="0"
Background="#fff"
2 years ago
CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="8*"/>
2 years ago
</Grid.RowDefinitions>
<hc:NotifyIcon Text="STranslate"
Click="NotifyIcon_Click"
IsBlink="False"
Visibility="Visible"
2 years ago
Icon="/Images/translate2.ico">
<hc:NotifyIcon.ContextMenu>
<ContextMenu>
<ContextMenu.Style>
<Style>
<Setter Property="ContextMenu.Width" Value="100"/>
</Style>
</ContextMenu.Style>
<MenuItem Command="hc:ControlCommands.PushMainWindow2Top"
Header="主界面"/>
<MenuItem Command="hc:ControlCommands.ShutdownApp"
Header="退出"/>
</ContextMenu>
</hc:NotifyIcon.ContextMenu>
</hc:NotifyIcon>
2 years ago
<!--input-->
<Grid x:Name="Input"
Margin="10,10,10,0">
2 years ago
<!--输入框-->
<Border x:Name="BorderInput"
Background="#f6f6f6"
BorderBrush="#000"
2 years ago
BorderThickness="1"
CornerRadius="4"
Margin="5"
Height="{Binding ElementName=Input, Path=Height}">
<TextBox x:Name="TextBoxInput"
Background="Transparent"
2 years ago
BorderBrush="{x:Null}"
Margin="5"
BorderThickness="0"
FontSize="18"
Width="{Binding ElementName=BorderInput, Path=ActualWidth}"
2 years ago
TextWrapping="Wrap"
VerticalAlignment="Top"
HorizontalAlignment="Left"
AcceptsReturn="True"
2 years ago
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">
2 years ago
<!--输出框-->
<Border x:Name="BorderOutput"
Background="#f6f6f6"
BorderBrush="#000"
2 years ago
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}"/>
2 years ago
</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>