mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Peek]Add wrap and formatting options for Monaco previewer (#29378)
* add options for monaco previewer * fix formatting
This commit is contained in:
committed by
GitHub
parent
9693fd7035
commit
5a06bcb473
@@ -8,7 +8,9 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Peek.Common;
|
||||
using Peek.FilePreviewer;
|
||||
using Peek.FilePreviewer.Models;
|
||||
using Peek.UI.Telemetry.Events;
|
||||
using Peek.UI.Views;
|
||||
|
||||
@@ -17,7 +19,7 @@ namespace Peek.UI
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
public partial class App : Application, IApp
|
||||
{
|
||||
public static int PowerToysPID { get; set; }
|
||||
|
||||
@@ -46,6 +48,7 @@ namespace Peek.UI
|
||||
// Core Services
|
||||
services.AddTransient<NeighboringItemsQuery>();
|
||||
services.AddSingleton<IUserSettings, UserSettings>();
|
||||
services.AddSingleton<IPreviewSettings, PreviewSettings>();
|
||||
|
||||
// Views and ViewModels
|
||||
services.AddTransient<TitleBar>();
|
||||
@@ -57,7 +60,7 @@ namespace Peek.UI
|
||||
UnhandledException += App_UnhandledException;
|
||||
}
|
||||
|
||||
public static T GetService<T>()
|
||||
public T GetService<T>()
|
||||
where T : class
|
||||
{
|
||||
if ((App.Current as App)!.Host.Services.GetService(typeof(T)) is not T service)
|
||||
|
||||
@@ -8,8 +8,10 @@ using ManagedCommon;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Peek.Common.Constants;
|
||||
using Peek.Common.Extensions;
|
||||
using Peek.FilePreviewer.Models;
|
||||
using Peek.UI.Extensions;
|
||||
using Peek.UI.Helpers;
|
||||
@@ -45,7 +47,7 @@ namespace Peek.UI
|
||||
Logger.LogError($"HandleThemeChange exception. Please install .NET 4.", e);
|
||||
}
|
||||
|
||||
ViewModel = App.GetService<MainWindowViewModel>();
|
||||
ViewModel = Application.Current.GetService<MainWindowViewModel>();
|
||||
|
||||
NativeEventWaiter.WaitForEventLoop(Constants.ShowPeekEvent(), OnPeekHotkey);
|
||||
|
||||
@@ -68,11 +70,11 @@ namespace Peek.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void PeekWindow_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
|
||||
private void PeekWindow_Activated(object sender, WindowActivatedEventArgs args)
|
||||
{
|
||||
if (args.WindowActivationState == Microsoft.UI.Xaml.WindowActivationState.Deactivated)
|
||||
if (args.WindowActivationState == WindowActivationState.Deactivated)
|
||||
{
|
||||
var userSettings = App.GetService<IUserSettings>();
|
||||
var userSettings = Application.Current.GetService<IUserSettings>();
|
||||
if (userSettings.CloseAfterLosingFocus)
|
||||
{
|
||||
Uninitialize();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Peek.UI
|
||||
|
||||
if (!_settingsUtils.SettingsExists(PeekModuleName))
|
||||
{
|
||||
Logger.LogInfo("Hosts settings.json was missing, creating a new one");
|
||||
Logger.LogInfo("Peek settings.json was missing, creating a new one");
|
||||
var defaultSettings = new PeekSettings();
|
||||
defaultSettings.Save(_settingsUtils);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user