mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 16:08:15 +08:00
save
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsRepeater Items="{Binding Authenticators}">
|
||||
<ItemsRepeater Items="{Binding Authenticators,Mode=OneWay}">
|
||||
<ItemsRepeater.Layout>
|
||||
<UniformGridLayout ItemsJustification="SpaceEvenly" MinRowSpacing="20" MaximumRowsOrColumns="8" />
|
||||
</ItemsRepeater.Layout>
|
||||
@@ -55,7 +55,7 @@
|
||||
</PathIcon>
|
||||
</TextBox.InnerRightContent>
|
||||
</TextBox>
|
||||
<Button DockPanel.Dock="Right" x:Name="delete_btn" Classes="flatbutton" IsVisible="False" Background="{DynamicResource ThemeBrushKey}" HorizontalAlignment="Right" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
<Button DockPanel.Dock="Right" x:Name="delete_btn" Classes="flatbutton" IsVisible="False" Background="{DynamicResource ThemeBrushKey}" HorizontalAlignment="Right" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_DeleteUser,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Command="{ReflectionBinding #u.DataContext.DeleteAuth}" CommandParameter="{Binding}">
|
||||
<PathIcon Data="{DynamicResource CloseDrawing}" Width="12"></PathIcon>
|
||||
</Button>
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace System.Application.Services
|
||||
public static AuthService Current { get; } = new();
|
||||
#endregion
|
||||
|
||||
public SourceList<MyAuthenticator> Authenticators { get; }
|
||||
public SourceCache<MyAuthenticator, int> Authenticators { get; }
|
||||
|
||||
public AuthService()
|
||||
{
|
||||
Authenticators = new SourceList<MyAuthenticator>();
|
||||
Authenticators = new SourceCache<MyAuthenticator, int>(t => t.Id);
|
||||
}
|
||||
|
||||
public async void Initialize(bool isSync = false)
|
||||
@@ -39,7 +39,7 @@ namespace System.Application.Services
|
||||
var list = await repository.GetAllAsync();
|
||||
if (list.Any_Nullable())
|
||||
{
|
||||
Authenticators.AddRange(list.Select(s => new MyAuthenticator(s)));
|
||||
Authenticators.AddOrUpdate(list.Select(s => new MyAuthenticator(s)));
|
||||
|
||||
if (isSync)
|
||||
{
|
||||
@@ -470,7 +470,7 @@ namespace System.Application.Services
|
||||
{
|
||||
return;
|
||||
}
|
||||
Current.Authenticators.Add(auth);
|
||||
Current.Authenticators.AddOrUpdate(auth);
|
||||
}
|
||||
|
||||
public static async void DeleteSaveAuthenticators(MyAuthenticator auth)
|
||||
@@ -481,7 +481,7 @@ namespace System.Application.Services
|
||||
await repository.DeleteAsync(auth.AuthenticatorData.ServerId.Value);
|
||||
}
|
||||
await repository.DeleteAsync(auth.AuthenticatorData.Id);
|
||||
await MainThreadDesktop.InvokeOnMainThreadAsync(() => Current.Authenticators.Remove(auth));
|
||||
Current.Authenticators.Remove(auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace System.Application.UI.ViewModels
|
||||
.Connect()
|
||||
//.Filter(scriptFilter)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
//.Sort(SortExpressionComparer<MyAuthenticator>.Ascending(x=>x.Name))
|
||||
.Sort(SortExpressionComparer<MyAuthenticator>.Ascending(x => x.Index).ThenBy(x => x.Name))
|
||||
.Bind(out _Authenticators)
|
||||
.Subscribe(_ => this.RaisePropertyChanged(nameof(IsAuthenticatorsEmpty)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user