mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[fxcop] Wox.Infrastructure (#7590)
* CA1052: Static holder types should be Static or NotInheritable * CA1041: Provide ObsoleteAttribute message * CA1062: Validate arguments of public methods * CA1304: Specify CultureInfo / CA1305: Specify IFormatProvider / CA1307: Specify StringComparison for clarity * CA1802: Use Literals Where Appropriate * CA1820: Test for empty strings using string length * CA1707: Identifiers should not contain underscores * CA1805: Do not initialize unnecessarily. * CA1822: Mark members as static * CA2227: Collection properties should be read only * CA1054: URI parameters should not be strings * CA1031: Do not catch general exception types * CA1060: Move P/Invokes to NativeMethods class * CA1308: Normalize strings to uppercase * CA2000: Dispose objects before losing scope / CA2234: Pass System.Uri objects instead of strings * CA2234: Pass System.Uri objects instead of strings * CA1044: Properties should not be write only * CA1716: Identifiers should not match keywords * CA2007: Do not directly await a Task * CA2007: Do not directly await a Task (Suppressed) * CA5350: Do Not Use Weak Cryptographic Algorithms (Suppressed) * CA1724: Type names should not match namespaces (renamed Settings.cs to PowerToysRunSettings.cs) * CA1033: Interface methods should be callable by child types (Added sealed modifier to class) * CA1724: Type names should not match namespaces (Renamed Plugin.cs to RunPlugin.cs) * CA1724: Type names should not match namespaces (Renamed Http.cs to HttpClient.cs) * CA5364: Do not use deprecated security protocols (Remove unused code) * Enabled FxCopAnalyzer for Wox.Infrastructure * fixed comment * Addressed comments - Changed Ordinal to InvariantCulture - Added comments - Removed unused obsolete code - Removed unused method (CA2007: Do not directly await a Task) * Addressed comments - fixed justification for CA1031 suppression * Addressed comments - Fixed justification for CA1031 suppression in Wox.Core/Wox.Plugin
This commit is contained in:
@@ -29,7 +29,7 @@ namespace PowerLauncher
|
||||
|
||||
private const string Unique = "PowerLauncher_Unique_Application_Mutex";
|
||||
private static bool _disposed;
|
||||
private Settings _settings;
|
||||
private PowerToysRunSettings _settings;
|
||||
private MainViewModel _mainVM;
|
||||
private MainWindow _mainWindow;
|
||||
private ThemeManager _themeManager;
|
||||
@@ -107,7 +107,7 @@ namespace PowerLauncher
|
||||
Current.MainWindow.Title = Constant.ExeFileName;
|
||||
|
||||
// main windows needs initialized before theme change because of blur settings
|
||||
Http.Proxy = _settings.Proxy;
|
||||
HttpClient.Proxy = _settings.Proxy;
|
||||
|
||||
RegisterExitEvents();
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ namespace PowerLauncher
|
||||
{
|
||||
public partial class MainWindow : IDisposable
|
||||
{
|
||||
private readonly Settings _settings;
|
||||
private readonly PowerToysRunSettings _settings;
|
||||
private readonly MainViewModel _viewModel;
|
||||
private bool _isTextSetProgrammatically;
|
||||
private bool _deletePressed;
|
||||
private Timer _firstDeleteTimer = new Timer();
|
||||
private bool _coldStateHotkeyPressed;
|
||||
|
||||
public MainWindow(Settings settings, MainViewModel mainVM)
|
||||
public MainWindow(PowerToysRunSettings settings, MainViewModel mainVM)
|
||||
: this()
|
||||
{
|
||||
DataContext = mainVM;
|
||||
|
||||
@@ -27,10 +27,11 @@ namespace PowerLauncher
|
||||
private const int MaxRetries = 10;
|
||||
private static readonly object _watcherSyncObject = new object();
|
||||
private readonly FileSystemWatcher _watcher;
|
||||
private readonly Settings _settings;
|
||||
private readonly PowerToysRunSettings _settings;
|
||||
|
||||
private readonly ThemeManager _themeManager;
|
||||
|
||||
public SettingsWatcher(Settings settings, ThemeManager themeManager)
|
||||
public SettingsWatcher(PowerToysRunSettings settings, ThemeManager themeManager)
|
||||
{
|
||||
_settingsUtils = new SettingsUtils(new SystemIOProvider());
|
||||
_settings = settings;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace PowerLauncher.ViewModel
|
||||
private readonly WoxJsonStorage<QueryHistory> _historyItemsStorage;
|
||||
private readonly WoxJsonStorage<UserSelectedRecord> _userSelectedRecordStorage;
|
||||
private readonly WoxJsonStorage<TopMostRecord> _topMostRecordStorage;
|
||||
private readonly Settings _settings;
|
||||
private readonly PowerToysRunSettings _settings;
|
||||
private readonly QueryHistory _history;
|
||||
private readonly UserSelectedRecord _userSelectedRecord;
|
||||
private readonly TopMostRecord _topMostRecord;
|
||||
@@ -53,7 +53,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
internal HotkeyManager HotkeyManager { get; set; }
|
||||
|
||||
public MainViewModel(Settings settings)
|
||||
public MainViewModel(PowerToysRunSettings settings)
|
||||
{
|
||||
_saved = false;
|
||||
_queryTextBeforeLeaveResults = string.Empty;
|
||||
@@ -87,7 +87,7 @@ namespace PowerLauncher.ViewModel
|
||||
HotkeyManager = new HotkeyManager();
|
||||
_settings.PropertyChanged += (s, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(Settings.Hotkey))
|
||||
if (e.PropertyName == nameof(PowerToysRunSettings.Hotkey))
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
private readonly object _collectionLock = new object();
|
||||
|
||||
private readonly Settings _settings;
|
||||
private readonly PowerToysRunSettings _settings;
|
||||
|
||||
public ResultsViewModel()
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace PowerLauncher.ViewModel
|
||||
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
|
||||
}
|
||||
|
||||
public ResultsViewModel(Settings settings)
|
||||
public ResultsViewModel(PowerToysRunSettings settings)
|
||||
: this()
|
||||
{
|
||||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
public class SettingWindowViewModel : BaseModel
|
||||
{
|
||||
private readonly WoxJsonStorage<Settings> _storage;
|
||||
private readonly WoxJsonStorage<PowerToysRunSettings> _storage;
|
||||
|
||||
public SettingWindowViewModel()
|
||||
{
|
||||
_storage = new WoxJsonStorage<Settings>();
|
||||
_storage = new WoxJsonStorage<PowerToysRunSettings>();
|
||||
Settings = _storage.Load();
|
||||
Settings.PropertyChanged += (s, e) =>
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace PowerLauncher.ViewModel
|
||||
};
|
||||
}
|
||||
|
||||
public Settings Settings { get; set; }
|
||||
public PowerToysRunSettings Settings { get; set; }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user