perf: remove useless codes

dev_without_third_libraries
DESKTOP-3BO4HSG\ksat 2 years ago
parent 4a15460c75
commit c7f13fbbb2

@ -141,22 +141,24 @@ namespace STranslate.Utils
[DllImport("User32", CharSet = CharSet.Unicode)] [DllImport("User32", CharSet = CharSet.Unicode)]
internal static extern IntPtr SetClipboardData(int uFormat, IntPtr hMem); internal static extern IntPtr SetClipboardData(int uFormat, IntPtr hMem);
const int HORZRES = 8; private const int HORZRES = 8;
const int VERTRES = 10; private const int VERTRES = 10;
const int LOGPIXELSX = 88; private const int LOGPIXELSX = 88;
const int LOGPIXELSY = 90; private const int LOGPIXELSY = 90;
const int DESKTOPVERTRES = 117; private const int DESKTOPVERTRES = 117;
const int DESKTOPHORZRES = 118; private const int DESKTOPHORZRES = 118;
[DllImport("user32.dll")] [DllImport("user32.dll")]
static extern IntPtr GetDC(IntPtr ptr); private static extern IntPtr GetDC(IntPtr ptr);
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
static extern int GetDeviceCaps( private static extern int GetDeviceCaps(
IntPtr hdc, // handle to DC IntPtr hdc, // handle to DC
int nIndex // index of capability int nIndex // index of capability
); );
[DllImport("user32.dll", EntryPoint = "ReleaseDC")] [DllImport("user32.dll", EntryPoint = "ReleaseDC")]
static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc); private static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
/// <summary> /// <summary>
/// 获取系统dpi /// 获取系统dpi
@ -216,6 +218,7 @@ namespace STranslate.Utils
} }
#region Clipboard #region Clipboard
internal static void SetText(string text) internal static void SetText(string text)
{ {
if (!OpenClipboard(IntPtr.Zero)) if (!OpenClipboard(IntPtr.Zero))
@ -243,6 +246,7 @@ namespace STranslate.Utils
CloseClipboard(); CloseClipboard();
return value; return value;
} }
#endregion
#endregion Clipboard
} }
} }

@ -46,6 +46,7 @@ namespace STranslate.ViewModel
} }
#region handle #region handle
public async Task Translate() public async Task Translate()
{ {
try try
@ -70,9 +71,11 @@ namespace STranslate.ViewModel
OutputTxt = ex.Message; OutputTxt = ex.Message;
} }
} }
#endregion
#endregion handle
#region Params #region Params
public ICommand TranslateCmd { get; private set; } public ICommand TranslateCmd { get; private set; }
public ICommand CopyResultCmd { get; private set; } public ICommand CopyResultCmd { get; private set; }
@ -93,6 +96,7 @@ namespace STranslate.ViewModel
private string _OutputComboSelected; private string _OutputComboSelected;
public string OutputComboSelected { get => _OutputComboSelected; set => UpdateProperty(ref _OutputComboSelected, value); } public string OutputComboSelected { get => _OutputComboSelected; set => UpdateProperty(ref _OutputComboSelected, value); }
#endregion
#endregion Params
} }
} }
Loading…
Cancel
Save