From 1f1ecb1af6f05277b3706e0bc234112cfe9b1cf5 Mon Sep 17 00:00:00 2001 From: "DESKTOP-3BO4HSG\\ksat" Date: Mon, 9 Jan 2023 17:22:19 +0800 Subject: [PATCH] tmp --- STranslate/STranslate.csproj | 20 +++++------ STranslate/View/ScreenShotWindow.xaml | 45 ++++++++++++++++++++++++ STranslate/View/ScreenShotWindow.xaml.cs | 30 ++++++++++++++++ STranslate/ViewModel/MainVM.cs | 5 ++- STranslate/ViewModel/ScreenShotVM.cs | 32 +++++++++++++++++ 5 files changed, 120 insertions(+), 12 deletions(-) create mode 100644 STranslate/View/ScreenShotWindow.xaml create mode 100644 STranslate/View/ScreenShotWindow.xaml.cs create mode 100644 STranslate/ViewModel/ScreenShotVM.cs diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj index 14e87b7..0d6d820 100644 --- a/STranslate/STranslate.csproj +++ b/STranslate/STranslate.csproj @@ -46,17 +46,7 @@             .allowedextension -   - AnyCPU - none - true - bin\Release\ - TRACE - prompt - 4 - false - Auto - +  AnyCPUnonetruebin\Release\TRACEprompt4falseAuto Images\translate.ico @@ -109,6 +99,10 @@ + + + ScreenShotWindow.xaml + MSBuild:Compile Designer @@ -153,6 +147,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/STranslate/View/ScreenShotWindow.xaml b/STranslate/View/ScreenShotWindow.xaml new file mode 100644 index 0000000..f2243d9 --- /dev/null +++ b/STranslate/View/ScreenShotWindow.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/STranslate/View/ScreenShotWindow.xaml.cs b/STranslate/View/ScreenShotWindow.xaml.cs new file mode 100644 index 0000000..cbc211f --- /dev/null +++ b/STranslate/View/ScreenShotWindow.xaml.cs @@ -0,0 +1,30 @@ +using STranslate.ViewModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace STranslate.View +{ + /// + /// ScreenShotWindow.xaml 的交互逻辑 + /// + public partial class ScreenShotWindow : Window + { + public ScreenShotWindow() + { + InitializeComponent(); + + DataContext = new ScreenShotVM(this); + } + } +} diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index fbfe68f..8067598 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -223,7 +223,10 @@ namespace STranslate.ViewModel /// public void ScreenShotTranslate() { - MessageBox.Show("aaa"); + //MessageBox.Show("aaa"); + var xx = new ScreenShotWindow(); + xx.Show(); + xx.Activate(); } /// diff --git a/STranslate/ViewModel/ScreenShotVM.cs b/STranslate/ViewModel/ScreenShotVM.cs new file mode 100644 index 0000000..05c9d9a --- /dev/null +++ b/STranslate/ViewModel/ScreenShotVM.cs @@ -0,0 +1,32 @@ +using STranslate.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; + +namespace STranslate.ViewModel +{ + public class ScreenShotVM : BaseVM + { + public ScreenShotVM(Window ui) + { + _ScreenShotWin = ui; + EscCmd = new RelayCommand((_) => true, (_) => + { + _ScreenShotWin.Close(); + }); + + + } + + public ICommand EscCmd { get; private set; } + public ICommand MouseMoveCmd { get; private set; } + public ICommand MouseLeftDownCmd { get; private set; } + public ICommand MouseLeftUpCmd { get; private set; } + + private Window _ScreenShotWin; + } +}