/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/previewpane/MonacoPreviewHandler/Program.cs
76 строк
3 KB
Jeremy Sinclair
[Analyzers] Resolve StyleCop issues: SA1516 and SA1616 (#34853)
16 сен 2024, 23:09
Не верифицирован
16 сен 2024, 23:09
37f2154
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Globalization; using System.Windows.Threading; using Common.UI; using ManagedCommon; using PowerToys.Interop; namespace Microsoft.PowerToys.PreviewHandler.Monaco { internal static class Program { private static CancellationTokenSource _tokenSource = new CancellationTokenSource(); private static MonacoPreviewHandlerControl _previewHandlerControl; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] public static void Main(string[] args) { Logger.InitializeLogger("\\FileExplorer_localLow\\Monaco\\logs", true); ApplicationConfiguration.Initialize(); if (args != null) { if (args.Length == 6) { string filePath = args[0]; IntPtr hwnd = IntPtr.Parse(args[1], NumberStyles.HexNumber, CultureInfo.InvariantCulture); int left = Convert.ToInt32(args[2], 10); int right = Convert.ToInt32(args[3], 10); int top = Convert.ToInt32(args[4], 10); int bottom = Convert.ToInt32(args[5], 10); Rectangle s = new Rectangle(left, top, right - left, bottom - top); _previewHandlerControl = new MonacoPreviewHandlerControl(); if (!_previewHandlerControl.SetWindow(hwnd, s)) { return; } _previewHandlerControl.DoPreview(filePath); NativeEventWaiter.WaitForEventLoop( Constants.DevFilesPreviewResizeEvent(), () => { Rectangle s = default; if (!_previewHandlerControl.SetRect(s)) { // When the parent HWND became invalid, the application won't respond to Application.Exit(). Environment.Exit(0); } }, Dispatcher.CurrentDispatcher, _tokenSource.Token); } else { MessageBox.Show("Wrong number of args: " + args.Length.ToString(CultureInfo.InvariantCulture)); } } // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. Application.Run(); } } }