mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +01:00
[Deps]Bump CommunityToolkit.Mvvm to 8.2.0 (#25992)
This commit is contained in:
committed by
GitHub
parent
a012d591c2
commit
0f6305f5fa
@@ -5,7 +5,7 @@
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Appium.WebDriver" Version="4.2.1" />
|
||||
<PackageVersion Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.18" />
|
||||
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.0.0" />
|
||||
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" />
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
|
||||
<PackageVersion Include="ControlzEx" Version="5.0.1" />
|
||||
|
||||
@@ -282,7 +282,7 @@ SOFTWARE.
|
||||
## NuGet Packages used by PowerToys
|
||||
|
||||
- CommunityToolkit.Labs.WinUI.SettingsControls 0.0.18
|
||||
- CommunityToolkit.Mvvm 8.0.0
|
||||
- CommunityToolkit.Mvvm 8.2.0
|
||||
- CommunityToolkit.WinUI.UI 7.1.2
|
||||
- CommunityToolkit.WinUI.UI.Controls 7.1.2
|
||||
- ControlzEx 5.0.1
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Hosts.Helpers
|
||||
|
||||
if (!e.Valid)
|
||||
{
|
||||
lineBuilder.Append(e.GetLine());
|
||||
lineBuilder.Append(e.Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,32 +12,33 @@ namespace Hosts.Models
|
||||
{
|
||||
public partial class Entry : ObservableObject
|
||||
{
|
||||
private string _line;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(Valid))]
|
||||
private string _address;
|
||||
|
||||
public string Address
|
||||
partial void OnAddressChanged(string value)
|
||||
{
|
||||
get => _address;
|
||||
set
|
||||
if (ValidationHelper.ValidIPv4(value))
|
||||
{
|
||||
SetProperty(ref _address, value);
|
||||
SetAddressType();
|
||||
OnPropertyChanged(nameof(Valid));
|
||||
Type = AddressType.IPv4;
|
||||
}
|
||||
else if (ValidationHelper.ValidIPv6(value))
|
||||
{
|
||||
Type = AddressType.IPv6;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = AddressType.Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(Valid))]
|
||||
private string _hosts;
|
||||
|
||||
public string Hosts
|
||||
partial void OnHostsChanged(string value)
|
||||
{
|
||||
get => _hosts;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _hosts, value);
|
||||
OnPropertyChanged(nameof(Valid));
|
||||
SplittedHosts = _hosts.Split(' ');
|
||||
}
|
||||
SplittedHosts = value.Split(' ');
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -55,7 +56,9 @@ namespace Hosts.Models
|
||||
[ObservableProperty]
|
||||
private bool _duplicate;
|
||||
|
||||
public bool Valid => ValidationHelper.ValidHosts(_hosts) && Type != AddressType.Invalid;
|
||||
public bool Valid => ValidationHelper.ValidHosts(Hosts) && Type != AddressType.Invalid;
|
||||
|
||||
public string Line { get; private set; }
|
||||
|
||||
public AddressType Type { get; private set; }
|
||||
|
||||
@@ -70,7 +73,7 @@ namespace Hosts.Models
|
||||
public Entry(int id, string line)
|
||||
{
|
||||
Id = id;
|
||||
_line = line.Trim();
|
||||
Line = line.Trim();
|
||||
Parse();
|
||||
}
|
||||
|
||||
@@ -85,9 +88,9 @@ namespace Hosts.Models
|
||||
|
||||
public void Parse()
|
||||
{
|
||||
Active = !_line.StartsWith("#", StringComparison.InvariantCultureIgnoreCase);
|
||||
Active = !Line.StartsWith("#", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
var lineSplit = _line.TrimStart(' ', '#').Split('#');
|
||||
var lineSplit = Line.TrimStart(' ', '#').Split('#');
|
||||
|
||||
if (lineSplit.Length == 0)
|
||||
{
|
||||
@@ -146,33 +149,12 @@ namespace Hosts.Models
|
||||
{
|
||||
return new Entry
|
||||
{
|
||||
_line = _line,
|
||||
Line = Line,
|
||||
Address = Address,
|
||||
Hosts = Hosts,
|
||||
Comment = Comment,
|
||||
Active = Active,
|
||||
};
|
||||
}
|
||||
|
||||
public string GetLine()
|
||||
{
|
||||
return _line;
|
||||
}
|
||||
|
||||
private void SetAddressType()
|
||||
{
|
||||
if (ValidationHelper.ValidIPv4(_address))
|
||||
{
|
||||
Type = AddressType.IPv4;
|
||||
}
|
||||
else if (ValidationHelper.ValidIPv6(_address))
|
||||
{
|
||||
Type = AddressType.IPv6;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = AddressType.Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,16 +65,12 @@ namespace Hosts.ViewModels
|
||||
[ObservableProperty]
|
||||
private bool _filtered;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showOnlyDuplicates;
|
||||
|
||||
public bool ShowOnlyDuplicates
|
||||
partial void OnShowOnlyDuplicatesChanged(bool value)
|
||||
{
|
||||
get => _showOnlyDuplicates;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _showOnlyDuplicates, value);
|
||||
ApplyFilters();
|
||||
}
|
||||
ApplyFilters();
|
||||
}
|
||||
|
||||
private ObservableCollection<Entry> _entries;
|
||||
@@ -126,11 +122,11 @@ namespace Hosts.ViewModels
|
||||
|
||||
public void UpdateAdditionalLines(string lines)
|
||||
{
|
||||
_additionalLines = lines;
|
||||
AdditionalLines = lines;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var error = !await _hostsService.WriteAsync(_additionalLines, _entries);
|
||||
var error = !await _hostsService.WriteAsync(AdditionalLines, _entries);
|
||||
await _dispatcherQueue.EnqueueAsync(() => Error = error);
|
||||
});
|
||||
}
|
||||
@@ -168,10 +164,11 @@ namespace Hosts.ViewModels
|
||||
Task.Run(async () =>
|
||||
{
|
||||
_readingHosts = true;
|
||||
(_additionalLines, var entries) = await _hostsService.ReadAsync();
|
||||
var (additionalLines, entries) = await _hostsService.ReadAsync();
|
||||
|
||||
await _dispatcherQueue.EnqueueAsync(() =>
|
||||
{
|
||||
AdditionalLines = additionalLines;
|
||||
_entries = new ObservableCollection<Entry>(entries);
|
||||
|
||||
foreach (var e in _entries)
|
||||
@@ -199,22 +196,22 @@ namespace Hosts.ViewModels
|
||||
{
|
||||
var expressions = new List<Expression<Func<object, bool>>>(4);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_addressFilter))
|
||||
if (!string.IsNullOrWhiteSpace(AddressFilter))
|
||||
{
|
||||
expressions.Add(e => ((Entry)e).Address.Contains(_addressFilter, StringComparison.OrdinalIgnoreCase));
|
||||
expressions.Add(e => ((Entry)e).Address.Contains(AddressFilter, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_hostsFilter))
|
||||
if (!string.IsNullOrWhiteSpace(HostsFilter))
|
||||
{
|
||||
expressions.Add(e => ((Entry)e).Hosts.Contains(_hostsFilter, StringComparison.OrdinalIgnoreCase));
|
||||
expressions.Add(e => ((Entry)e).Hosts.Contains(HostsFilter, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_commentFilter))
|
||||
if (!string.IsNullOrWhiteSpace(CommentFilter))
|
||||
{
|
||||
expressions.Add(e => ((Entry)e).Comment.Contains(_commentFilter, StringComparison.OrdinalIgnoreCase));
|
||||
expressions.Add(e => ((Entry)e).Comment.Contains(CommentFilter, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
if (_showOnlyDuplicates)
|
||||
if (ShowOnlyDuplicates)
|
||||
{
|
||||
expressions.Add(e => ((Entry)e).Duplicate);
|
||||
}
|
||||
@@ -244,10 +241,10 @@ namespace Hosts.ViewModels
|
||||
|
||||
public async Task PingSelectedAsync()
|
||||
{
|
||||
var selected = _selected;
|
||||
var selected = Selected;
|
||||
selected.Ping = null;
|
||||
selected.Pinging = true;
|
||||
selected.Ping = await _hostsService.PingAsync(_selected.Address);
|
||||
selected.Ping = await _hostsService.PingAsync(Selected.Address);
|
||||
selected.Pinging = false;
|
||||
}
|
||||
|
||||
@@ -289,7 +286,7 @@ namespace Hosts.ViewModels
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var error = !await _hostsService.WriteAsync(_additionalLines, _entries);
|
||||
var error = !await _hostsService.WriteAsync(AdditionalLines, _entries);
|
||||
await _dispatcherQueue.EnqueueAsync(() => Error = error);
|
||||
});
|
||||
}
|
||||
@@ -298,7 +295,7 @@ namespace Hosts.ViewModels
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var error = !await _hostsService.WriteAsync(_additionalLines, _entries);
|
||||
var error = !await _hostsService.WriteAsync(AdditionalLines, _entries);
|
||||
await _dispatcherQueue.EnqueueAsync(() => Error = error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Peek.FilePreviewer.Previewers
|
||||
|
||||
private IFileSystemItem File { get; }
|
||||
|
||||
public bool IsPreviewLoaded => preview != null;
|
||||
public bool IsPreviewLoaded => Preview != null;
|
||||
|
||||
private DispatcherQueue Dispatcher { get; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user