From c7f13fbbb2cd7d46b6d4b54726eddcd5a659acc4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-3BO4HSG\\ksat" Date: Mon, 19 Dec 2022 17:00:52 +0800 Subject: [PATCH] perf: remove useless codes --- STranslate/Utils/NativeMethod.cs | 26 +++++++++++++++----------- STranslate/ViewModel/MainVM.cs | 8 ++++++-- STranslate/packages.config | 6 +++--- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/STranslate/Utils/NativeMethod.cs b/STranslate/Utils/NativeMethod.cs index 15caf9e..184a366 100644 --- a/STranslate/Utils/NativeMethod.cs +++ b/STranslate/Utils/NativeMethod.cs @@ -141,22 +141,24 @@ namespace STranslate.Utils [DllImport("User32", CharSet = CharSet.Unicode)] internal static extern IntPtr SetClipboardData(int uFormat, IntPtr hMem); - const int HORZRES = 8; - const int VERTRES = 10; - const int LOGPIXELSX = 88; - const int LOGPIXELSY = 90; - const int DESKTOPVERTRES = 117; - const int DESKTOPHORZRES = 118; + private const int HORZRES = 8; + private const int VERTRES = 10; + private const int LOGPIXELSX = 88; + private const int LOGPIXELSY = 90; + private const int DESKTOPVERTRES = 117; + private const int DESKTOPHORZRES = 118; [DllImport("user32.dll")] - static extern IntPtr GetDC(IntPtr ptr); + private static extern IntPtr GetDC(IntPtr ptr); + [DllImport("gdi32.dll")] - static extern int GetDeviceCaps( + private static extern int GetDeviceCaps( IntPtr hdc, // handle to DC int nIndex // index of capability ); + [DllImport("user32.dll", EntryPoint = "ReleaseDC")] - static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc); + private static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc); /// /// 获取系统dpi @@ -216,6 +218,7 @@ namespace STranslate.Utils } #region Clipboard + internal static void SetText(string text) { if (!OpenClipboard(IntPtr.Zero)) @@ -243,6 +246,7 @@ namespace STranslate.Utils CloseClipboard(); return value; } - #endregion + + #endregion Clipboard } -} +} \ No newline at end of file diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index db0b7d2..f08a193 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -46,6 +46,7 @@ namespace STranslate.ViewModel } #region handle + public async Task Translate() { try @@ -70,9 +71,11 @@ namespace STranslate.ViewModel OutputTxt = ex.Message; } } - #endregion + + #endregion handle #region Params + public ICommand TranslateCmd { get; private set; } public ICommand CopyResultCmd { get; private set; } @@ -93,6 +96,7 @@ namespace STranslate.ViewModel private string _OutputComboSelected; public string OutputComboSelected { get => _OutputComboSelected; set => UpdateProperty(ref _OutputComboSelected, value); } - #endregion + + #endregion Params } } \ No newline at end of file diff --git a/STranslate/packages.config b/STranslate/packages.config index baae49f..78498af 100644 --- a/STranslate/packages.config +++ b/STranslate/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file