mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Analyzers] Update StyleCop and enable SA1200 (#22707)
* update StyleCop and enable SA1200 * Fix merge issues * fix build and added using rule
This commit is contained in:
committed by
GitHub
parent
617150cf50
commit
6d138e80fb
@@ -2,12 +2,12 @@
|
||||
// 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;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
public sealed class FileCountConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// 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;
|
||||
using System.IO;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
public sealed class FileListToDescriptionConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
// 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;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using Windows.Storage;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
using Windows.Storage;
|
||||
|
||||
public sealed class PidToIconConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// 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;
|
||||
using System.Globalization;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
public sealed class UserToSystemWarningVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
|
||||
@@ -2,23 +2,20 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using FileLocksmith.Interop;
|
||||
using global::FileLocksmithUI.Helpers;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using FileLocksmith.Interop;
|
||||
using global::FileLocksmithUI;
|
||||
using global::FileLocksmithUI.Helpers;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
#pragma warning disable CA1708 // Identifiers should differ by more than case
|
||||
public partial class MainViewModel : ObservableObject, IDisposable
|
||||
#pragma warning restore CA1708 // Identifiers should differ by more than case
|
||||
@@ -31,7 +28,7 @@ namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
private bool _disposed;
|
||||
private CancellationTokenSource _cancelProcessWatching;
|
||||
|
||||
public ObservableCollection<ProcessResult> Processes { get; } = new ();
|
||||
public ObservableCollection<ProcessResult> Processes { get; } = new();
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// 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;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using PowerToys.FileLocksmithUI.ViewModels;
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Views
|
||||
{
|
||||
using System;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using PowerToys.FileLocksmithUI.ViewModels;
|
||||
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public MainViewModel ViewModel { get; private set; }
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// 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;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Hosts.Helpers
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal class NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
|
||||
@@ -13,11 +13,10 @@ using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Windows.Graphics;
|
||||
using WinUIEx;
|
||||
using static NativeMethods;
|
||||
|
||||
namespace MeasureToolUI
|
||||
{
|
||||
using static NativeMethods;
|
||||
|
||||
/// <summary>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace Awake.Core
|
||||
_log.Error($"An error occurred initializing the tray. {ex.Message}");
|
||||
_log.Error($"{ex.StackTrace}");
|
||||
}
|
||||
}, TrayIcon);
|
||||
},
|
||||
TrayIcon);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -38,19 +38,21 @@ namespace ColorPicker.Behaviors
|
||||
{
|
||||
Task.Run(
|
||||
new Action(() =>
|
||||
{
|
||||
Dispatcher.BeginInvoke(
|
||||
new Action(() =>
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
var data = new DataObject();
|
||||
data.SetData("Source", (sender as FrameworkElement).DataContext);
|
||||
DragDrop.DoDragDrop(sender as DependencyObject, data, DragDropEffects.Move);
|
||||
e.Handled = true;
|
||||
}
|
||||
}), null);
|
||||
}), CancellationToken.None);
|
||||
{
|
||||
Dispatcher.BeginInvoke(
|
||||
new Action(() =>
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
var data = new DataObject();
|
||||
data.SetData("Source", (sender as FrameworkElement).DataContext);
|
||||
DragDrop.DoDragDrop(sender as DependencyObject, data, DragDropEffects.Move);
|
||||
e.Handled = true;
|
||||
}
|
||||
}),
|
||||
null);
|
||||
}),
|
||||
CancellationToken.None);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,28 +103,28 @@ namespace ColorPicker.Controls
|
||||
HueGradientSlider.Background = gradientBrush;
|
||||
}
|
||||
|
||||
private static void SetColorVariationsForCurrentColor(DependencyObject d, (double hue, double saturation, double value) hsv)
|
||||
private static void SetColorVariationsForCurrentColor(DependencyObject d, (double Hue, double Saturation, double Value) hsv)
|
||||
{
|
||||
var hueCoefficient = 0;
|
||||
var hueCoefficient2 = 0;
|
||||
if (1 - hsv.value < 0.15)
|
||||
if (1 - hsv.Value < 0.15)
|
||||
{
|
||||
hueCoefficient = 1;
|
||||
}
|
||||
|
||||
if (hsv.value - 0.3 < 0)
|
||||
if (hsv.Value - 0.3 < 0)
|
||||
{
|
||||
hueCoefficient2 = 1;
|
||||
}
|
||||
|
||||
var s = hsv.saturation;
|
||||
var s = hsv.Saturation;
|
||||
var control = (ColorPickerControl)d;
|
||||
|
||||
control.colorVariation1Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 8), 360), s, Math.Min(hsv.value + 0.3, 1)));
|
||||
control.colorVariation2Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 4), 360), s, Math.Min(hsv.value + 0.15, 1)));
|
||||
control.colorVariation1Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.Hue + (hueCoefficient * 8), 360), s, Math.Min(hsv.Value + 0.3, 1)));
|
||||
control.colorVariation2Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.Hue + (hueCoefficient * 4), 360), s, Math.Min(hsv.Value + 0.15, 1)));
|
||||
|
||||
control.colorVariation3Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 4), 0), s, Math.Max(hsv.value - 0.2, 0)));
|
||||
control.colorVariation4Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 8), 0), s, Math.Max(hsv.value - 0.3, 0)));
|
||||
control.colorVariation3Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.Hue - (hueCoefficient2 * 4), 0), s, Math.Max(hsv.Value - 0.2, 0)));
|
||||
control.colorVariation4Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.Hue - (hueCoefficient2 * 8), 0), s, Math.Max(hsv.Value - 0.3, 0)));
|
||||
}
|
||||
|
||||
private void UpdateValueColorGradient(double posX)
|
||||
@@ -312,9 +312,9 @@ namespace ColorPicker.Controls
|
||||
{
|
||||
var hsv = ColorFormatHelper.ConvertToHSVColor(color);
|
||||
|
||||
var huePosition = (hsv.hue / 360) * HueGradientSlider.Maximum;
|
||||
var saturationPosition = hsv.saturation * SaturationGradientSlider.Maximum;
|
||||
var valuePosition = hsv.value * ValueGradientSlider.Maximum;
|
||||
var huePosition = (hsv.Hue / 360) * HueGradientSlider.Maximum;
|
||||
var saturationPosition = hsv.Saturation * SaturationGradientSlider.Maximum;
|
||||
var valuePosition = hsv.Value * ValueGradientSlider.Maximum;
|
||||
UpdateHueColorGradient(huePosition);
|
||||
UpdateSaturationColorGradient(saturationPosition);
|
||||
UpdateValueColorGradient(valuePosition);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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;
|
||||
using System.Drawing;
|
||||
|
||||
namespace ColorPicker.Helpers
|
||||
@@ -17,7 +16,7 @@ namespace ColorPicker.Helpers
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to convert</param>
|
||||
/// <returns>The int / 255d for each value to get value between 0 and 1</returns>
|
||||
internal static (double red, double green, double blue) ConvertToDouble(Color color)
|
||||
internal static (double Red, double Green, double Blue) ConvertToDouble(Color color)
|
||||
=> (color.R / 255d, color.G / 255d, color.B / 255d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace ColorPicker.ViewModels
|
||||
{
|
||||
".TXT" => colors.ToTxt(';'),
|
||||
".JSON" => colors.ToJson(),
|
||||
_ => string.Empty
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
File.WriteAllText(dialog.FileName, contentToWrite);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using ColorPicker.Helpers;
|
||||
using ManagedCommon;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
@@ -57,13 +56,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToHSLColor(color);
|
||||
|
||||
// hue[0°..360°]
|
||||
Assert.AreEqual(result.hue, hue, 0.2d);
|
||||
Assert.AreEqual(result.Hue, hue, 0.2d);
|
||||
|
||||
// saturation[0..1]
|
||||
Assert.AreEqual(result.saturation * 100d, saturation, 0.2d);
|
||||
Assert.AreEqual(result.Saturation * 100d, saturation, 0.2d);
|
||||
|
||||
// lightness[0..1]
|
||||
Assert.AreEqual(result.lightness * 100d, lightness, 0.2d);
|
||||
Assert.AreEqual(result.Lightness * 100d, lightness, 0.2d);
|
||||
}
|
||||
|
||||
// test values taken from https://de.wikipedia.org/wiki/HSV-Farbraum
|
||||
@@ -106,13 +105,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToHSVColor(color);
|
||||
|
||||
// hue [0°..360°]
|
||||
Assert.AreEqual(result.hue, hue, 0.2d);
|
||||
Assert.AreEqual(result.Hue, hue, 0.2d);
|
||||
|
||||
// saturation[0..1]
|
||||
Assert.AreEqual(result.saturation * 100d, saturation, 0.2d);
|
||||
Assert.AreEqual(result.Saturation * 100d, saturation, 0.2d);
|
||||
|
||||
// value[0..1]
|
||||
Assert.AreEqual(result.value * 100d, value, 0.2d);
|
||||
Assert.AreEqual(result.Value * 100d, value, 0.2d);
|
||||
}
|
||||
|
||||
// test values taken from https://de.wikipedia.org/wiki/HSV-Farbraum
|
||||
@@ -155,13 +154,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToHSBColor(color);
|
||||
|
||||
// hue [0°..360°]
|
||||
Assert.AreEqual(result.hue, hue, 0.2d);
|
||||
Assert.AreEqual(result.Hue, hue, 0.2d);
|
||||
|
||||
// saturation[0..1]
|
||||
Assert.AreEqual(result.saturation * 100d, saturation, 0.2d);
|
||||
Assert.AreEqual(result.Saturation * 100d, saturation, 0.2d);
|
||||
|
||||
// value[0..1]
|
||||
Assert.AreEqual(result.brightness * 100d, value, 0.2d);
|
||||
Assert.AreEqual(result.Brightness * 100d, value, 0.2d);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -199,16 +198,16 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToCMYKColor(color);
|
||||
|
||||
// cyan[0..1]
|
||||
Assert.AreEqual(result.cyan * 100d, cyan, 0.5d);
|
||||
Assert.AreEqual(result.Cyan * 100d, cyan, 0.5d);
|
||||
|
||||
// magenta[0..1]
|
||||
Assert.AreEqual(result.magenta * 100d, magenta, 0.5d);
|
||||
Assert.AreEqual(result.Magenta * 100d, magenta, 0.5d);
|
||||
|
||||
// yellow[0..1]
|
||||
Assert.AreEqual(result.yellow * 100d, yellow, 0.5d);
|
||||
Assert.AreEqual(result.Yellow * 100d, yellow, 0.5d);
|
||||
|
||||
// black[0..1]
|
||||
Assert.AreEqual(result.blackKey * 100d, blackKey, 0.5d);
|
||||
Assert.AreEqual(result.BlackKey * 100d, blackKey, 0.5d);
|
||||
}
|
||||
|
||||
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
|
||||
@@ -249,13 +248,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToHSIColor(color);
|
||||
|
||||
// hue[0°..360°]
|
||||
Assert.AreEqual(result.hue, hue, 0.5d);
|
||||
Assert.AreEqual(result.Hue, hue, 0.5d);
|
||||
|
||||
// saturation[0..1]
|
||||
Assert.AreEqual(result.saturation * 100d, saturation, 0.5d);
|
||||
Assert.AreEqual(result.Saturation * 100d, saturation, 0.5d);
|
||||
|
||||
// intensity[0..1]
|
||||
Assert.AreEqual(result.intensity * 100d, intensity, 0.5d);
|
||||
Assert.AreEqual(result.Intensity * 100d, intensity, 0.5d);
|
||||
}
|
||||
|
||||
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
|
||||
@@ -297,13 +296,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToHWBColor(color);
|
||||
|
||||
// hue[0°..360°]
|
||||
Assert.AreEqual(result.hue, hue, 0.5d);
|
||||
Assert.AreEqual(result.Hue, hue, 0.5d);
|
||||
|
||||
// whiteness[0..1]
|
||||
Assert.AreEqual(result.whiteness * 100d, whiteness, 0.5d);
|
||||
Assert.AreEqual(result.Whiteness * 100d, whiteness, 0.5d);
|
||||
|
||||
// blackness[0..1]
|
||||
Assert.AreEqual(result.blackness * 100d, blackness, 0.5d);
|
||||
Assert.AreEqual(result.Blackness * 100d, blackness, 0.5d);
|
||||
}
|
||||
|
||||
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
|
||||
@@ -345,13 +344,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToNaturalColor(color);
|
||||
|
||||
// hue
|
||||
Assert.AreEqual(result.hue, hue);
|
||||
Assert.AreEqual(result.Hue, hue);
|
||||
|
||||
// whiteness[0..1]
|
||||
Assert.AreEqual(result.whiteness * 100d, whiteness, 0.5d);
|
||||
Assert.AreEqual(result.Whiteness * 100d, whiteness, 0.5d);
|
||||
|
||||
// blackness[0..1]
|
||||
Assert.AreEqual(result.blackness * 100d, blackness, 0.5d);
|
||||
Assert.AreEqual(result.Blackness * 100d, blackness, 0.5d);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -401,13 +400,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToCIELABColor(color);
|
||||
|
||||
// lightness[0..100]
|
||||
Assert.AreEqual(Math.Round(result.lightness, 2), lightness);
|
||||
Assert.AreEqual(Math.Round(result.Lightness, 2), lightness);
|
||||
|
||||
// chromaticityA[-128..127]
|
||||
Assert.AreEqual(Math.Round(result.chromaticityA, 2), chromaticityA);
|
||||
Assert.AreEqual(Math.Round(result.ChromaticityA, 2), chromaticityA);
|
||||
|
||||
// chromaticityB[-128..127]
|
||||
Assert.AreEqual(Math.Round(result.chromaticityB, 2), chromaticityB);
|
||||
Assert.AreEqual(Math.Round(result.ChromaticityB, 2), chromaticityB);
|
||||
}
|
||||
|
||||
// The following results are computed using LittleCMS2, an open-source color management engine,
|
||||
@@ -465,13 +464,13 @@ namespace Microsoft.ColorPicker.UnitTests
|
||||
var result = ColorFormatHelper.ConvertToCIEXYZColor(color);
|
||||
|
||||
// x[0..0.95047]
|
||||
Assert.AreEqual(Math.Round(result.x * 100, 4), x);
|
||||
Assert.AreEqual(Math.Round(result.X * 100, 4), x);
|
||||
|
||||
// y[0..1]
|
||||
Assert.AreEqual(Math.Round(result.y * 100, 4), y);
|
||||
Assert.AreEqual(Math.Round(result.Y * 100, 4), y);
|
||||
|
||||
// z[0..1.08883]
|
||||
Assert.AreEqual(Math.Round(result.z * 100, 4), z);
|
||||
Assert.AreEqual(Math.Round(result.Z * 100, 4), z);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// 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.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FancyZonesEditor.Controls
|
||||
{
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomSlider.xaml
|
||||
/// </summary>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// 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.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FancyZonesEditor.Controls
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
internal class CustomSliderAutomationPeer : SliderAutomationPeer
|
||||
{
|
||||
private string name = string.Empty;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace ImageResizer.Models
|
||||
var batch = CreateBatch(_ => { });
|
||||
batch.Files.Add("Image1.jpg");
|
||||
batch.Files.Add("Image2.jpg");
|
||||
var calls = new ConcurrentBag<(int i, double count)>();
|
||||
var calls = new ConcurrentBag<(int I, double Count)>();
|
||||
|
||||
batch.Process(
|
||||
(i, count) => calls.Add((i, count)),
|
||||
|
||||
@@ -111,9 +111,9 @@ namespace ImageResizer.Extensions
|
||||
/// <returns>
|
||||
/// metadata path and metadata value of all successfully read data items.
|
||||
/// </returns>
|
||||
public static List<(string metadataPath, object value)> GetListOfMetadata(this BitmapMetadata metadata)
|
||||
public static List<(string MetadataPath, object Value)> GetListOfMetadata(this BitmapMetadata metadata)
|
||||
{
|
||||
var listOfAllMetadata = new List<(string metadataPath, object value)>();
|
||||
var listOfAllMetadata = new List<(string MetadataPath, object Value)>();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -196,7 +196,7 @@ namespace ImageResizer.Extensions
|
||||
foreach (var metadataItem in listOfMetadata)
|
||||
{
|
||||
// Debug.WriteLine($"modifiableMetadata.RemoveQuerySafe(\"{metadataItem.metadataPath}\");");
|
||||
Debug.WriteLine($"{metadataItem.metadataPath} | {metadataItem.value}");
|
||||
Debug.WriteLine($"{metadataItem.MetadataPath} | {metadataItem.Value}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,9 +207,9 @@ namespace ImageResizer.Extensions
|
||||
/// <remarks>
|
||||
/// Intented for debug only!!!
|
||||
/// </remarks>
|
||||
public static List<(string metadataPath, object value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
|
||||
public static List<(string MetadataPath, object Value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
|
||||
{
|
||||
var listOfAllMetadata = new List<(string metadataPath, object value)>();
|
||||
var listOfAllMetadata = new List<(string MetadataPath, object Value)>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Wox.Plugin.Interfaces;
|
||||
|
||||
namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
using Wox.Plugin.Interfaces;
|
||||
|
||||
public class SearchResult : IFileDropResult
|
||||
{
|
||||
public string Path { get; set; }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
return query.Any(c => c.Equals('>'));
|
||||
}
|
||||
|
||||
private (string search, string incompleteName) Process(string search)
|
||||
private (string Search, string IncompleteName) Process(string search)
|
||||
{
|
||||
string incompleteName = string.Empty;
|
||||
if (HasSpecialChars(search) || !_directory.Exists($@"{search}\"))
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Wox.Plugin.Interfaces;
|
||||
|
||||
namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
{
|
||||
using Wox.Plugin.Interfaces;
|
||||
|
||||
public class SearchResult : IFileDropResult
|
||||
{
|
||||
// Contains the Path of the file or folder
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void ErrorResultOnInvalidKeywordQuery(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "=");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "=");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault().SubTitle;
|
||||
@@ -56,8 +56,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void NoResultOnInvalidGlobalQuery(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString);
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString);
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).Count;
|
||||
@@ -80,9 +80,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void NoResultIfQueryEndsWithBinaryOperator(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString);
|
||||
Query expectedQueryWithKeyword = new ("=" + typedString, "=");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString);
|
||||
Query expectedQueryWithKeyword = new("=" + typedString, "=");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).Count;
|
||||
@@ -101,9 +101,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void NoErrorForDivisionByNumberWithDecimalDigits(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString);
|
||||
Query expectedQueryWithKeyword = new ("=" + typedString, "=");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString);
|
||||
Query expectedQueryWithKeyword = new("=" + typedString, "=");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault().SubTitle;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
return !trailTest.Any();
|
||||
}
|
||||
|
||||
private static (TrailDirection direction, TrailType type) BracketTrail(char @char)
|
||||
private static (TrailDirection Direction, TrailType Type) BracketTrail(char @char)
|
||||
{
|
||||
switch (@char)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
@"pi|" +
|
||||
@"==|~=|&&|\|\||" +
|
||||
@"e|[0-9]|0x[0-9a-fA-F]+|0b[01]+|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||
@")+$", RegexOptions.Compiled);
|
||||
@")+$",
|
||||
RegexOptions.Compiled);
|
||||
|
||||
public static bool InputValid(string input)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
/// </summary>
|
||||
/// <param name="query">The query to search</param>
|
||||
/// <returns>A combination of a list of base <see cref="RegistryKey"/> and the sub keys</returns>
|
||||
internal static (IEnumerable<RegistryKey>? baseKey, string subKey) GetRegistryBaseKey(in string query)
|
||||
internal static (IEnumerable<RegistryKey>? BaseKey, string SubKey) GetRegistryBaseKey(in string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
{
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void IconThemeDarkTest(string typedString, string subTitleMatch, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Mock<Main> main = new();
|
||||
main.Object.IconTheme = "dark";
|
||||
Query expectedQuery = new ("(" + typedString, "(");
|
||||
Query expectedQuery = new("(" + typedString, "(");
|
||||
|
||||
// Act
|
||||
string result = main.Object.Query(expectedQuery).FirstOrDefault(predicate: x => x.SubTitle.StartsWith(subTitleMatch, System.StringComparison.CurrentCulture)).IcoPath;
|
||||
@@ -108,9 +108,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void IconThemeLightTest(string typedString, string subTitleMatch, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Mock<Main> main = new();
|
||||
main.Object.IconTheme = "light";
|
||||
Query expectedQuery = new ("(" + typedString, "(");
|
||||
Query expectedQuery = new("(" + typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault(x => x.SubTitle.StartsWith(subTitleMatch, System.StringComparison.CurrentCulture)).IcoPath;
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void CountWithoutPluginKeyword(string typedString, int expectedResultCount)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString);
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString);
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).Count;
|
||||
@@ -63,8 +63,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void CountWithPluginKeyword(string typedString, int expectedResultCount)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery);
|
||||
@@ -87,8 +87,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void ValidateBehaviorOnGlobalQueries(string typedString, int expectedResultCount)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString);
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString);
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery);
|
||||
@@ -141,8 +141,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void CanFindFormatResult(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault(x => x.SubTitle.StartsWith(expectedResult, StringComparison.CurrentCulture));
|
||||
@@ -160,8 +160,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void DateTimeNumberOnlyInput(string typedString, string expectedResult)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault(x => x.SubTitle.StartsWith(expectedResult, StringComparison.CurrentCulture));
|
||||
@@ -188,8 +188,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void InvalidInputNotShowsResults(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault();
|
||||
@@ -206,8 +206,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void InvalidNumberInputShowsErrorMessage(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault().Title;
|
||||
@@ -224,8 +224,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void InvalidInputNotShowsErrorMessage(string typedString)
|
||||
{
|
||||
// Setup
|
||||
Mock<Main> main = new ();
|
||||
Query expectedQuery = new (typedString, "(");
|
||||
Mock<Main> main = new();
|
||||
Query expectedQuery = new(typedString, "(");
|
||||
|
||||
// Act
|
||||
var result = main.Object.Query(expectedQuery).FirstOrDefault();
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// 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;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using DrawingImaging = System.Drawing.Imaging;
|
||||
using MediaImaging = System.Windows.Media.Imaging;
|
||||
|
||||
namespace PowerLauncher.Helper
|
||||
{
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using DrawingImaging = System.Drawing.Imaging;
|
||||
using MediaImaging = System.Windows.Media.Imaging;
|
||||
|
||||
// based on: https://stackoverflow.com/questions/61041282/showing-image-thumbnail-with-mouse-cursor-while-dragging/61148788#61148788
|
||||
public static class DragDataObject
|
||||
{
|
||||
|
||||
@@ -153,10 +153,11 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
Task.Run(
|
||||
() =>
|
||||
{
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
UpdateResultView(e.Results, e.Query.RawQuery, _updateToken);
|
||||
}, _updateToken);
|
||||
{
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
UpdateResultView(e.Results, e.Query.RawQuery, _updateToken);
|
||||
},
|
||||
_updateToken);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -553,26 +554,47 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
var queryResultsTask = Task.Factory.StartNew(
|
||||
() =>
|
||||
{
|
||||
Thread.Sleep(20);
|
||||
|
||||
// Keep track of total number of results for telemetry
|
||||
var numResults = 0;
|
||||
|
||||
// Contains all the plugins for which this raw query is valid
|
||||
var plugins = pluginQueryPairs.Keys.ToList();
|
||||
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
try
|
||||
{
|
||||
var resultPluginPair = new System.Collections.Concurrent.ConcurrentDictionary<PluginMetadata, List<Result>>();
|
||||
Thread.Sleep(20);
|
||||
|
||||
if (_settings.PTRunNonDelayedSearchInParallel)
|
||||
// Keep track of total number of results for telemetry
|
||||
var numResults = 0;
|
||||
|
||||
// Contains all the plugins for which this raw query is valid
|
||||
var plugins = pluginQueryPairs.Keys.ToList();
|
||||
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
|
||||
try
|
||||
{
|
||||
Parallel.ForEach(pluginQueryPairs, (pluginQueryItem) =>
|
||||
var resultPluginPair = new System.Collections.Concurrent.ConcurrentDictionary<PluginMetadata, List<Result>>();
|
||||
|
||||
if (_settings.PTRunNonDelayedSearchInParallel)
|
||||
{
|
||||
try
|
||||
Parallel.ForEach(pluginQueryPairs, (pluginQueryItem) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var plugin = pluginQueryItem.Key;
|
||||
var query = pluginQueryItem.Value;
|
||||
query.SelectedItems = _userSelectedRecord.GetGenericHistory();
|
||||
var results = PluginManager.QueryForPlugin(plugin, query);
|
||||
resultPluginPair[plugin.Metadata] = results;
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
});
|
||||
sw.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// To execute a query corresponding to each plugin
|
||||
foreach (KeyValuePair<PluginPair, Query> pluginQueryItem in pluginQueryPairs)
|
||||
{
|
||||
var plugin = pluginQueryItem.Key;
|
||||
var query = pluginQueryItem.Value;
|
||||
@@ -581,64 +603,43 @@ namespace PowerLauncher.ViewModel
|
||||
resultPluginPair[plugin.Metadata] = results;
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
});
|
||||
sw.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// To execute a query corresponding to each plugin
|
||||
foreach (KeyValuePair<PluginPair, Query> pluginQueryItem in pluginQueryPairs)
|
||||
{
|
||||
var plugin = pluginQueryItem.Key;
|
||||
var query = pluginQueryItem.Value;
|
||||
query.SelectedItems = _userSelectedRecord.GetGenericHistory();
|
||||
var results = PluginManager.QueryForPlugin(plugin, query);
|
||||
resultPluginPair[plugin.Metadata] = results;
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
}
|
||||
|
||||
lock (_addResultsLock)
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
lock (_addResultsLock)
|
||||
{
|
||||
Results.Clear();
|
||||
foreach (var p in resultPluginPair)
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
UpdateResultView(p.Value, queryText, currentCancellationToken);
|
||||
Results.Clear();
|
||||
foreach (var p in resultPluginPair)
|
||||
{
|
||||
UpdateResultView(p.Value, queryText, currentCancellationToken);
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
numResults = Results.Results.Count;
|
||||
if (!doFinalSort)
|
||||
{
|
||||
Results.Sort(queryTuning);
|
||||
Results.SelectedItem = Results.Results.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
numResults = Results.Results.Count;
|
||||
if (!doFinalSort)
|
||||
{
|
||||
Results.Sort(queryTuning);
|
||||
Results.SelectedItem = Results.Results.FirstOrDefault();
|
||||
UpdateResultsListViewAfterQuery(queryText);
|
||||
}
|
||||
}
|
||||
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
if (!doFinalSort)
|
||||
bool noInitialResults = numResults == 0;
|
||||
|
||||
if (!delayedExecution.HasValue || delayedExecution.Value)
|
||||
{
|
||||
UpdateResultsListViewAfterQuery(queryText);
|
||||
}
|
||||
}
|
||||
|
||||
bool noInitialResults = numResults == 0;
|
||||
|
||||
if (!delayedExecution.HasValue || delayedExecution.Value)
|
||||
{
|
||||
// Run the slower query of the DelayedExecution plugins
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
Parallel.ForEach(plugins, (plugin) =>
|
||||
// Run the slower query of the DelayedExecution plugins
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
Parallel.ForEach(plugins, (plugin) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -683,22 +684,23 @@ namespace PowerLauncher.ViewModel
|
||||
// nothing to do here
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
queryTimer.Stop();
|
||||
var queryEvent = new LauncherQueryEvent()
|
||||
{
|
||||
QueryTimeMs = queryTimer.ElapsedMilliseconds,
|
||||
NumResults = numResults,
|
||||
QueryLength = queryText.Length,
|
||||
};
|
||||
PowerToysTelemetry.Log.WriteEvent(queryEvent);
|
||||
}, currentCancellationToken);
|
||||
queryTimer.Stop();
|
||||
var queryEvent = new LauncherQueryEvent()
|
||||
{
|
||||
QueryTimeMs = queryTimer.ElapsedMilliseconds,
|
||||
NumResults = numResults,
|
||||
QueryLength = queryText.Length,
|
||||
};
|
||||
PowerToysTelemetry.Log.WriteEvent(queryEvent);
|
||||
},
|
||||
currentCancellationToken);
|
||||
|
||||
if (doFinalSort)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// 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;
|
||||
using PowerToys.PowerAccentKeyboardService;
|
||||
using Windows.Globalization;
|
||||
|
||||
namespace PowerAccent.Core
|
||||
{
|
||||
using System;
|
||||
using PowerToys.PowerAccentKeyboardService;
|
||||
using Windows.Globalization;
|
||||
|
||||
public enum Language
|
||||
{
|
||||
ALL,
|
||||
|
||||
@@ -100,7 +100,8 @@ public class PowerAccent : IDisposable
|
||||
{
|
||||
OnChangeDisplay?.Invoke(true, _characters);
|
||||
}
|
||||
}, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
},
|
||||
TaskScheduler.FromCurrentSynchronizationContext());
|
||||
}
|
||||
|
||||
private string GetCharacterDescription(string character)
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace PowerAccent.Core.Services;
|
||||
|
||||
using System.IO.Abstractions;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using PowerToys.PowerAccentKeyboardService;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text.Json;
|
||||
using static Vanara.PInvoke.LANGID;
|
||||
|
||||
namespace PowerAccent.Core.Services;
|
||||
public class SettingsService
|
||||
{
|
||||
private const string PowerAccentModuleName = "QuickAccent";
|
||||
|
||||
@@ -41,7 +41,7 @@ internal static class WindowsFunctions
|
||||
|
||||
public static Point GetCaretPosition()
|
||||
{
|
||||
User32.GUITHREADINFO guiInfo = new ();
|
||||
User32.GUITHREADINFO guiInfo = default;
|
||||
guiInfo.cbSize = (uint)Marshal.SizeOf(guiInfo);
|
||||
User32.GetGUIThreadInfo(0, ref guiInfo);
|
||||
POINT caretPosition = new POINT(guiInfo.rcCaret.left, guiInfo.rcCaret.top);
|
||||
@@ -59,12 +59,12 @@ internal static class WindowsFunctions
|
||||
|
||||
public static (Point Location, Size Size, double Dpi) GetActiveDisplay()
|
||||
{
|
||||
User32.GUITHREADINFO guiInfo = new ();
|
||||
User32.GUITHREADINFO guiInfo = default;
|
||||
guiInfo.cbSize = (uint)Marshal.SizeOf(guiInfo);
|
||||
User32.GetGUIThreadInfo(0, ref guiInfo);
|
||||
var res = User32.MonitorFromWindow(guiInfo.hwndActive, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
User32.MONITORINFO monitorInfo = new ();
|
||||
User32.MONITORINFO monitorInfo = default;
|
||||
monitorInfo.cbSize = (uint)Marshal.SizeOf(monitorInfo);
|
||||
User32.GetMonitorInfo(res, ref monitorInfo);
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ internal static class Program
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
}, _tokenSource.Token);
|
||||
},
|
||||
_tokenSource.Token);
|
||||
}
|
||||
|
||||
private static void Arguments(string[] args)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace PowerAccent.UI;
|
||||
|
||||
public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
{
|
||||
private readonly Core.PowerAccent _powerAccent = new ();
|
||||
private readonly Core.PowerAccent _powerAccent = new();
|
||||
|
||||
private Visibility _characterNameVisibility = Visibility.Visible;
|
||||
|
||||
@@ -84,7 +84,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
|
||||
private void SetWindowPosition()
|
||||
{
|
||||
Size windowSize = new (((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualWidth, ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualHeight);
|
||||
Size windowSize = new(((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualWidth, ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualHeight);
|
||||
Point position = _powerAccent.GetDisplayCoordinates(windowSize);
|
||||
this.Left = position.X;
|
||||
this.Top = position.Y;
|
||||
@@ -97,7 +97,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
Position.Left or Position.TopLeft or Position.BottomLeft => HorizontalAlignment.Left,
|
||||
Position.Right or Position.TopRight or Position.BottomRight => HorizontalAlignment.Right,
|
||||
Position.Center or Position.Top or Position.Bottom => HorizontalAlignment.Center,
|
||||
_ => HorizontalAlignment.Center
|
||||
_ => HorizontalAlignment.Center,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// 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 interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static CancellationTokenSource _tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 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;
|
||||
|
||||
namespace Microsoft.PowerToys.ThumbnailHandler.Gcode
|
||||
{
|
||||
using System.Globalization;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static GcodeThumbnailProvider _thumbnailProvider;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// 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 interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static CancellationTokenSource _tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 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.Text.Json;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters
|
||||
{
|
||||
using System.Text.Json;
|
||||
|
||||
public class JsonFormatter : IFormatter
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// 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.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters
|
||||
{
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
public class XmlFormatter : IFormatter
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// 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 interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static CancellationTokenSource _tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// 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 interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Pdf
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static CancellationTokenSource _tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 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;
|
||||
|
||||
namespace Microsoft.PowerToys.ThumbnailHandler.Pdf
|
||||
{
|
||||
using System.Globalization;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static PdfThumbnailProvider _thumbnailProvider;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// 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;
|
||||
|
||||
namespace Microsoft.PowerToys.ThumbnailHandler.Stl
|
||||
{
|
||||
using System.Globalization;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static StlThumbnailProvider _thumbnailProvider;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// 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 interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Svg
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static CancellationTokenSource _tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 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;
|
||||
|
||||
namespace Microsoft.PowerToys.ThumbnailHandler.Svg
|
||||
{
|
||||
using System.Globalization;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static SvgThumbnailProvider _thumbnailProvider;
|
||||
|
||||
Reference in New Issue
Block a user