mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Build] Upgraded NetAnalyzers to 7.0.1 (#24792)
* upgraded NetAnalyzers to 7.0.1 * fix spellcheck * Microsoft.CodeAnalysis.NetAnalyzers 7.0.1 * rebase and fix
This commit is contained in:
committed by
GitHub
parent
5492b4ae62
commit
5cbe9dd911
@@ -241,7 +241,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
// skip entries with empty name or duplicated name, it should never occur
|
||||
string storedName = storedColorFormat.Key;
|
||||
if (storedName == string.Empty || ColorFormats.Count(x => x.Name.ToUpperInvariant().Equals(storedName.ToUpperInvariant(), StringComparison.Ordinal)) > 0)
|
||||
if (storedName == string.Empty || ColorFormats.Any(x => x.Name.ToUpperInvariant().Equals(storedName.ToUpperInvariant(), StringComparison.Ordinal)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public Action<FlyoutMenuItem> EnabledChangedCallback { get; set; } = null;
|
||||
public Action<FlyoutMenuItem> EnabledChangedCallback { get; set; }
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Timers;
|
||||
@@ -9,8 +10,11 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
|
||||
{
|
||||
public class FlyoutViewModel
|
||||
public class FlyoutViewModel : IDisposable
|
||||
{
|
||||
private Timer _hideTimer;
|
||||
private bool _disposed;
|
||||
|
||||
public bool CanHide { get; set; }
|
||||
|
||||
private bool _windows10;
|
||||
@@ -28,29 +32,27 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
|
||||
}
|
||||
}
|
||||
|
||||
private Timer hideTimer;
|
||||
|
||||
public FlyoutViewModel()
|
||||
{
|
||||
CanHide = true;
|
||||
hideTimer = new Timer();
|
||||
hideTimer.Elapsed += HideTimer_Elapsed;
|
||||
hideTimer.Interval = 1000;
|
||||
hideTimer.Enabled = false;
|
||||
_hideTimer = new Timer();
|
||||
_hideTimer.Elapsed += HideTimer_Elapsed;
|
||||
_hideTimer.Interval = 1000;
|
||||
_hideTimer.Enabled = false;
|
||||
_windows10 = !Helper.Windows11();
|
||||
}
|
||||
|
||||
private void HideTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
CanHide = true;
|
||||
hideTimer.Stop();
|
||||
_hideTimer.Stop();
|
||||
}
|
||||
|
||||
internal void DisableHiding()
|
||||
{
|
||||
CanHide = false;
|
||||
hideTimer.Stop();
|
||||
hideTimer.Start();
|
||||
_hideTimer.Stop();
|
||||
_hideTimer.Start();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
@@ -59,5 +61,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_hideTimer?.Dispose();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,12 +178,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
AvailableLanguages.Clear();
|
||||
foreach (Language language in possibleOcrLanguages)
|
||||
{
|
||||
if (_powerOcrSettings.Properties.PreferredLanguage?.Equals(language.DisplayName) == true)
|
||||
if (_powerOcrSettings.Properties.PreferredLanguage?.Equals(language.DisplayName, StringComparison.Ordinal) == true)
|
||||
{
|
||||
preferredLanguageIndex = AvailableLanguages.Count;
|
||||
}
|
||||
|
||||
if (systemCulture.DisplayName.Equals(language.DisplayName) || systemCulture.Parent.DisplayName.Equals(language.DisplayName))
|
||||
if (systemCulture.DisplayName.Equals(language.DisplayName, StringComparison.Ordinal) || systemCulture.Parent.DisplayName.Equals(language.DisplayName, StringComparison.Ordinal))
|
||||
{
|
||||
systemLanguageIndex = AvailableLanguages.Count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user