diff --git a/STranslate/Images/iconfont.ttf b/STranslate/Images/iconfont.ttf new file mode 100644 index 0000000..abfa740 Binary files /dev/null and b/STranslate/Images/iconfont.ttf differ diff --git a/STranslate/MainWindow.xaml b/STranslate/MainWindow.xaml index 4aae442..38fed92 100644 --- a/STranslate/MainWindow.xaml +++ b/STranslate/MainWindow.xaml @@ -19,14 +19,255 @@ SizeToContent="Height" Width="400" Icon="/Images/translate.ico"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -38,14 +279,28 @@ - @@ -56,15 +311,14 @@ - - + + SelectedItem="{Binding InputComboSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> @@ -138,8 +386,7 @@ @@ -149,67 +396,35 @@ BorderBrush="{x:Null}" BorderThickness="0" IsReadOnly="True" - Margin="5,5,5,30" + Margin="10,10,5,35" MaxHeight="400" FontSize="16" TextWrapping="Wrap" VerticalContentAlignment="Top" HorizontalScrollBarVisibility="Disabled" - VerticalScrollBarVisibility="Auto" + VerticalScrollBarVisibility="Hidden" Text="{Binding OutputTxt}"/> - + Command="{Binding CopyResultCmd}"/> - - - - - + Command="{Binding CopyLargeHumpResultCmd}"/> diff --git a/STranslate/MainWindow.xaml.cs b/STranslate/MainWindow.xaml.cs index d9573a7..550fb29 100644 --- a/STranslate/MainWindow.xaml.cs +++ b/STranslate/MainWindow.xaml.cs @@ -88,7 +88,7 @@ namespace STranslate this.Hide(); //取消置顶 - this.TopImg.Source = UnLockImgPath; + vm.TopImgSource = UnLockImgPath; } //置顶 Ctrl+Shift+T if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control) @@ -159,7 +159,7 @@ namespace STranslate /// private void Window_Deactivated(object sender, EventArgs e) { - if (this.TopImg.Source == UnLockImgPath) + if (vm.TopImgSource == UnLockImgPath) { this.Hide(); } @@ -244,7 +244,7 @@ namespace STranslate /// private void Top_Click(object sender, RoutedEventArgs e) { - this.TopImg.Source = TopImg.Source == LockImgPath ? UnLockImgPath : LockImgPath; + vm.TopImgSource = vm.TopImgSource == LockImgPath ? UnLockImgPath : LockImgPath; } /// /// 退出 @@ -259,7 +259,7 @@ namespace STranslate } private void InitView() { - this.TopImg.Source = UnLockImgPath; + vm.TopImgSource = UnLockImgPath; this.Activate(); this.TextBoxInput.Focus(); diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj index eff20bd..2d58541 100644 --- a/STranslate/STranslate.csproj +++ b/STranslate/STranslate.csproj @@ -125,6 +125,9 @@ ResXFileCodeGenerator Resources.Designer.cs + + PreserveNewest + SettingsSingleFileGenerator diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index 2a456b4..58b0db5 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using System.Windows.Media.Imaging; namespace STranslate.ViewModel { @@ -213,6 +214,12 @@ namespace STranslate.ViewModel private string _LargeHumpRet; public string LargeHumpRet { get => _LargeHumpRet; set => UpdateProperty(ref _LargeHumpRet, value); } + /// + /// 置顶图标 + /// + private BitmapImage _TopImgSource; + public BitmapImage TopImgSource { get => _TopImgSource; set => UpdateProperty(ref _TopImgSource, value); } + private string _InputTxt; public string InputTxt { get => _InputTxt; set => UpdateProperty(ref _InputTxt, value); }