mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +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 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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user