Compare commits

...
Author SHA1 Message Date
Aigio Liu 21ae674895 ⬆️ Update Common 2023-08-30 19:47:52 +08:00
Aigio Liu 500a87d62f ✨ AvaloniaFilePickerFileTypeFilter 2023-08-30 15:35:53 +08:00
john.jiang d1ae1787b7 🎨 fixs 2023-08-30 13:43:42 +08:00
RMBGAME 5742158c83 🚧 Misc 2023-08-30 09:31:13 +08:00
RMBGAME 235525a9f3 🐛 库存游戏加载图片逻辑优化 2023-08-30 05:52:05 +08:00
RMBGAME 329340ae2d 🐛 Fixed Bugs 2023-08-30 04:29:52 +08:00
RMBGAME e8e6808930 💄 文本过长宽度过小 显示优化 2023-08-30 02:54:56 +08:00
RMBGAME a77fb08a04 🐛 Fixed Bugs 2023-08-30 02:27:05 +08:00
RMBGAME c05fe78d2d 🐛 修复交易确认首次登录失败 2023-08-30 02:27:04 +08:00
ff m 7b6b8a9b2d 🐛脚本匹配域名等优先读取本地文件的内容 2023-08-30 02:11:06 +08:00
Aigio Liu 3886a96f61 🚧 3.0.0-preview.4 2023-08-29 18:13:38 +08:00
41 changed files with 379 additions and 181 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ public static partial class AssemblyInfo
/// <summary>
/// 预览版本号,范围 1~9
/// </summary>
const string ver_for_preview = "3";
const string ver_for_preview = "4";
/// <summary>
/// RC 版本号,范围 0~9
@@ -197,11 +197,27 @@ sealed class AvaloniaFilePickerPlatformService : BaseService, IServiceBase, IOpe
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static IReadOnlyList<APS_FilePickerFileType>? Convert(IFilePickerFileType? fileTypes)
{
if (fileTypes is FilePickerFileTypeWrapper impl)
if (fileTypes is AvaloniaFilePickerFileTypeFilter ava)
{
var items = ava.Values;
if (items != null)
{
var query = from m in items
select new APS_FilePickerFileType(m.Name)
{
Patterns = m.Patterns,
AppleUniformTypeIdentifiers = m.AppleUniformTypeIdentifiers,
MimeTypes = m.MimeTypes,
};
return query.ToArray();
}
return null;
}
else if (fileTypes is FilePickerFileTypeWrapper impl)
{
return impl.Values;
}
if (fileTypes is FilePickerFileType.IFilePickerFileTypeWithName @interface)
else if (fileTypes is FilePickerFileType.IFilePickerFileTypeWithName @interface)
{
var values = @interface.GetFileTypes();
if (values.Any())
@@ -1,6 +1,8 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation;
using System.Xml.Linq;
namespace BD.WTTS.Services.Implementation;
@@ -50,11 +52,20 @@ public sealed class NavigationService : INavigationService
_overlayHost = p;
}
public void Navigate(Type? t, NavigationTransitionEffect effect = NavigationTransitionEffect.None)
public void Navigate(Type? t, NavigationTransitionEffect effect = NavigationTransitionEffect.None, bool useCache = true)
{
_frame.ThrowIsNull();
var navOptions = new FrameNavigationOptions
{
IsNavigationStackEnabled = useCache,
TransitionInfoOverride = GetNavigationTransitionInfo(effect)
};
if (t == null)
{
_frame?.Navigate(typeof(ErrorPage), null, GetNavigationTransitionInfo(effect));
navOptions.IsNavigationStackEnabled = false;
_frame.NavigateToType(typeof(ErrorPage), null, navOptions);
return;
}
@@ -66,19 +77,45 @@ public sealed class NavigationService : INavigationService
if (t == null)
{
_frame?.Navigate(typeof(ErrorPage), null, GetNavigationTransitionInfo(effect));
navOptions.IsNavigationStackEnabled = false;
_frame.NavigateToType(typeof(ErrorPage), null, navOptions);
return;
}
if (_frame?.Content?.GetType() != t)
if (_frame.Content?.GetType() != t)
{
_frame?.Navigate(t, null, GetNavigationTransitionInfo(effect));
_frame.NavigateToType(t, null, navOptions);
//if (!useCache && navOptions.IsNavigationStackEnabled)
//{
// _frame.BackStack.Remove(_frame.BackStack.Last());
//}
}
}
public void GoBack()
public void GoBack(Type? t = null)
{
_frame?.GoBack();
if (t == null)
{
_frame?.GoBack();
return;
}
if (t.IsSubclassOf(typeof(ViewModelBase)))
{
var pageType = GetViewModelToPageContent(t, false);
t = pageType as Type;
}
if (t == null)
{
_frame?.GoBack();
return;
}
if (_frame?.CurrentSourcePageType == t)
{
_frame?.GoBack();
}
}
public void NavigateFromContext(object dataContext, NavigationTransitionEffect effect = NavigationTransitionEffect.None)
@@ -105,7 +142,6 @@ public sealed class NavigationService : INavigationService
public void ClearOverlay()
{
_overlayHost?.Children.Clear();
}
private static NavigationTransitionInfo GetNavigationTransitionInfo(NavigationTransitionEffect effect)
@@ -20,8 +20,8 @@
IsVisible="{TemplateBinding IsLoading}"
Spacing="8">
<spp:Image2
Width="150"
Height="150"
Width="100"
Height="100"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
RenderOptions.BitmapInterpolationMode="HighQuality"
@@ -31,6 +31,14 @@
HorizontalAlignment="Center"
Text="{Binding Path=Res.GameList_IsLoading, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock
HorizontalAlignment="Center"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
IsVisible="{TemplateBinding CustomLoadingText,
Converter={StaticResource IsNullConverter},
ConverterParameter=invert}"
Text="{TemplateBinding CustomLoadingText}"
Theme="{StaticResource BodyStrongTextBlockStyle}" />
<Border
Width="35"
Height="35"
@@ -157,6 +157,7 @@
<TextBlock
Name="ControlNameTextBlock"
FontSize="36"
MaxLines="2"
Text="{TemplateBinding Title}"
Theme="{StaticResource TitleTextBlockStyle}">
<TextBlock.Transitions>
@@ -174,6 +175,7 @@
<TextBlock
FontStyle="Italic"
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
MaxLines="2"
Text="{TemplateBinding Subtitle}"
Theme="{StaticResource CaptionTextBlockStyle}" />
</Button>
@@ -182,6 +184,7 @@
FontStyle="Italic"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
IsVisible="False"
MaxLines="4"
Text="{Binding Path=Description, RelativeSource={RelativeSource TemplatedParent}}"
Theme="{StaticResource CaptionTextBlockStyle}" />
</StackPanel>
@@ -270,6 +273,11 @@
</Setter>
</Style>
<Style Selector="spp|PageBase:namespace /template/ Panel#OptionsRegion Button">
<Setter Property="MaxWidth" Value="200" />
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
</Style>
<Style Selector="spp|PageBase:namespace /template/ Button#NamespaceText">
<Setter Property="IsVisible" Value="True" />
</Style>
@@ -163,9 +163,9 @@ public class PageBase : UserControl
{
var sz = e.NewSize.Width;
bool isSmallWidth2 = sz < 580;
bool isSmallWidth2 = sz < 640;
PseudoClasses.Set(":smallWidth", sz < 710);
PseudoClasses.Set(":smallWidth", sz < 800);
PseudoClasses.Set(":smallWidth2", isSmallWidth2);
if (isSmallWidth2 && !_isSmallWidth2)
@@ -48,6 +48,12 @@ public class ContentLoader : ContentControl
public static readonly StyledProperty<bool> IsShowNoResultTextProperty =
AvaloniaProperty.Register<ContentLoader, bool>(nameof(IsShowNoResultText), false);
/// <summary>
/// Defines the <see cref="CustomLoadingText"/> property
/// </summary>
public static readonly StyledProperty<string?> CustomLoadingTextProperty =
AvaloniaProperty.Register<ContentLoader, string?>(nameof(CustomLoadingText), null);
/// <summary>
/// 是否正在加载中
/// </summary>
@@ -69,6 +75,15 @@ public class ContentLoader : ContentControl
set => SetValue(IsShowNoResultTextProperty, value);
}
/// <summary>
/// 自定义加载提示
/// </summary>
public string? CustomLoadingText
{
get => GetValue(CustomLoadingTextProperty);
set => SetValue(CustomLoadingTextProperty, value);
}
/// <summary>
/// 无结果时提示
/// </summary>
@@ -76,18 +76,6 @@ public sealed class CustomFilePicker : ContentControl
private async void CustomFilePicker_Tapped(object? sender, RoutedEventArgs e)
{
//if (string.IsNullOrEmpty(FileExtensions) || FileExtensions == "*")
//{
// fileTypes = new ValueTuple<string, string[]>[] { ("All Files", new[] { "*" }) };
//}
//else
//{
// fileTypes = new ValueTuple<string, string[]>[] {
// ("Required Files", FileExtensions.Split(",")),
// ("All Files", new[] { "*" }),
// };
//}
var result = await FilePicker2.PickAsync(PickOptions.Images);
if (result != null)
{
@@ -3,6 +3,8 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Avalonia.Xaml.Interactivity"
xmlns:ia="using:Avalonia.Xaml.Interactions.Core"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
@@ -67,16 +69,40 @@
Spacing="8" />
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Button Padding="0" Classes="Plain">
<DataTemplate x:DataType="x:Int32">
<Button
Padding="0"
Classes="Plain"
Click="CarouselBannerIndexButton_Click"
Tag="{Binding}">
<Ellipse
Name="IndexEllipse"
Width="10"
Height="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{ReflectionBinding}"
Opacity="0.6"
StrokeThickness="0" />
<i:Interaction.Behaviors>
<ia:DataTriggerBehavior
Binding="{Binding}"
ComparisonCondition="Equal"
Value="{Binding #Carousel.SelectedIndex}">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="IndexEllipse"
Value="#FFFFFF" />
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior
Binding="{Binding}"
ComparisonCondition="NotEqual"
Value="{Binding #Carousel.SelectedIndex}">
<ia:ChangePropertyAction
PropertyName="Fill"
TargetObject="IndexEllipse"
Value="#ADADAD" />
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
</Button>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
@@ -107,6 +107,14 @@ namespace BD.WTTS.UI.Views.Controls
});
}
private void CarouselBannerIndexButton_Click(object? sender, RoutedEventArgs e)
{
if (sender is Button button && button.Tag is int index)
{
Carousel.SelectedIndex = index;
}
}
private void SwipersLoad()
{
if (Carousel.ItemCount <= 0)
@@ -122,13 +130,13 @@ namespace BD.WTTS.UI.Views.Controls
else
{
Left.IsVisible = Right.IsVisible = Swiper.IsVisible = true;
var arr = new string[Carousel.ItemCount];
var arr = new int[Carousel.ItemCount];
for (var i = 0; i < arr.Length; i++)
{
arr[i] = "#ADADAD";
arr[i] = i;
}
var index = Carousel.SelectedIndex < 0 ? 0 : Carousel.SelectedIndex;
arr[index] = "#FFFFFF";
//var index = Carousel.SelectedIndex < 0 ? 0 : Carousel.SelectedIndex;
//arr[index] = "#FFFFFF";
Swiper.ItemsSource = arr;
}
@@ -336,7 +336,7 @@
</ScrollViewer>
<TextBlock
Margin="-2,0,0,0"
Margin="-3,0,0,0"
Text="已安装功能"
Theme="{StaticResource TitleTextBlockStyle}" />
@@ -9,34 +9,34 @@ public partial class HomePage : ReactiveUserControl<HomePageViewModel>
InitializeComponent();
this.SetViewModel<HomePageViewModel>(false);
ShopsScrollViewer.PointerWheelChanged += ShopsScrollViewer_PointerWheelChanged;
//ShopsScrollViewer.PointerWheelChanged += ShopsScrollViewer_PointerWheelChanged;
}
private void ShopsScrollViewer_PointerWheelChanged(object? sender, PointerWheelEventArgs e)
{
if (sender is ScrollViewer scroll)
if (scroll.IsPointerOver)
if (scroll.Extent.Height > scroll.Viewport.Height || scroll.Extent.Width > scroll.Viewport.Width)
{
var delta = e.Delta;
//private void ShopsScrollViewer_PointerWheelChanged(object? sender, PointerWheelEventArgs e)
//{
// if (sender is ScrollViewer scroll)
// if (scroll.IsPointerOver)
// if (scroll.Extent.Height > scroll.Viewport.Height || scroll.Extent.Width > scroll.Viewport.Width)
// {
// var delta = e.Delta;
var isScrollStart = scroll.Offset.X == 0;
var isScrollEnd = scroll.Offset.X + scroll.Bounds.Size.Width >= scroll.Extent.Width;
if (isScrollStart && MathUtilities.IsOne(e.Delta.Y))
{
return;
}
if (isScrollEnd && e.Delta.Y == -1)
{
return;
}
if (MathUtilities.IsZero(delta.X))
{
var horizontalOffset = scroll.Offset.X;
horizontalOffset -= delta.Y * 50; // 根据事件参数来调整滚动的距离
scroll.Offset = new Vector(horizontalOffset, scroll.Offset.Y);
e.Handled = true;
}
}
}
// var isScrollStart = scroll.Offset.X == 0;
// var isScrollEnd = scroll.Offset.X + scroll.Bounds.Size.Width >= scroll.Extent.Width;
// if (isScrollStart && MathUtilities.IsOne(e.Delta.Y))
// {
// return;
// }
// if (isScrollEnd && e.Delta.Y == -1)
// {
// return;
// }
// if (MathUtilities.IsZero(delta.X))
// {
// var horizontalOffset = scroll.Offset.X;
// horizontalOffset -= delta.Y * 50; // 根据事件参数来调整滚动的距离
// scroll.Offset = new Vector(horizontalOffset, scroll.Offset.Y);
// e.Handled = true;
// }
// }
//}
}
@@ -180,7 +180,7 @@
ClipToBounds="True"
CornerRadius="30">
<spp:Image2
DecodeWidth="32"
DecodeWidth="36"
FallbackSource="{StaticResource DefaultAvatar}"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding Path=AvatarPath, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
@@ -30,10 +30,22 @@
<TextBlock Margin="0,10,0,5" Theme="{StaticResource BodyStrongTextBlockStyle}">
<Run Text="{Binding Path=Res.Plugin_InstalledPlugins, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}({1})">
<CompiledBinding
Mode="OneWay"
Path="Res.Plugin_InstalledPlugins"
Source="{x:Static s:ResourceService.Current}" />
<CompiledBinding
Mode="OneWay"
Path="MainWindow2.PluginCount"
Source="{x:Static s:IViewModelManager.Instance}" />
</MultiBinding>
</TextBlock.Text>
<!--<Run Text="{Binding Path=Res.Plugin_InstalledPlugins, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Run Text="(" />
<Run Text="{Binding MainWindow2.PluginCount, Mode=OneWay, Source={x:Static s:IViewModelManager.Instance}}" />
<Run Text=")" />
<Run Text=")" />-->
</TextBlock>
<ItemsControl Classes="DraggableOrder" ItemsSource="{Binding Plugins}">
@@ -35,6 +35,16 @@ public partial class LoginOrRegisterPage : ReactiveUserControl<LoginOrRegisterWi
{
base.OnLoaded(e);
this.SetViewModel<LoginOrRegisterWindowViewModel>(false);
if (this.ViewModel != null)
{
this.ViewModel.LoginState = 0;
if (UserService.Current.IsAuthenticated)
{
Toast.Show(ToastIcon.Info, "当前已是登录状态");
this.ViewModel.Close();
}
}
}
protected override void OnDataContextChanged(EventArgs e)
@@ -148,6 +148,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
info.LocalId = oldInfo.LocalId;
info.Id = oldInfo.Id;
info.Order = oldInfo.Order;
info.IconUrl = oldInfo.IconUrl;
if (isNoRepeat)
{
var state = await DeleteScriptAsync(oldInfo, false);
@@ -164,13 +165,10 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
info.UpdateLink = oldInfo.UpdateLink;
info.DownloadLink = oldInfo.DownloadLink;
info.IconUrl = oldInfo.IconUrl;
info.AuthorName = oldInfo.AuthorName;
info.Describe = oldInfo.Describe;
info.UpdateTime = oldInfo.UpdateTime;
info.AccelerateProjects = oldInfo.AccelerateProjects;
info.Version = oldInfo.Version;
info.ExcludeDomainNames = oldInfo.ExcludeDomainNames;
info.MatchDomainNames = oldInfo.MatchDomainNames;
info.Name = oldInfo.Name;
}
}
@@ -17,7 +17,7 @@ partial class ProxyService
if (!proxyDomains.Any_Nullable())
{
Toast.Show(ToastIcon.Warning, "你没有启用任何加速项!!");
Toast.Show(ToastIcon.Warning, Strings.CommunityFix_AccEmpty);
}
IReadOnlyCollection<ScriptIPCDTO>? scripts = default;
@@ -15,24 +15,18 @@ public partial class ScriptPageViewModel : TabItemViewModel
//AllEnableScriptCommand = ReactiveCommand.Create(AllEnableScript);
AddNewScriptCommand = ReactiveCommand.CreateFromTask(async () =>
{
FilePickerFileType? fileTypes;
if (IApplication.IsDesktop())
{
fileTypes = new ValueTuple<string, string[]>[]
{
("JavaScript Files", new[] { $"*{FileEx.JS}", }),
("Text Files", new[] { $"*{FileEx.TXT}", }),
//("All Files", new[] { "*", }),
};
}
else if (OperatingSystem2.IsAndroid())
{
fileTypes = new[] { MediaTypeNames.TXT, MediaTypeNames.JS };
}
else
{
fileTypes = null;
}
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new("JavaScript Files") {
Patterns = new[] { "*.js", },
MimeTypes = new[] { MediaTypeNames.JS, },
//AppleUniformTypeIdentifiers =
},
new("Text Files") {
Patterns = new[] { "*.txt", },
MimeTypes = new[] { MediaTypeNames.TXT, },
//AppleUniformTypeIdentifiers =
},
};
await FilePicker2.PickAsync(ProxyService.Current.AddNewScriptAsync, fileTypes);
});
@@ -140,19 +140,18 @@ public static class AuthenticatorHelper
SaveFileResult? exportFile = null;
if (Essentials.IsSupportedSaveFileDialog)
{
FilePickerFileType? fileTypes;
if (IApplication.IsDesktop())
{
fileTypes = new ValueTuple<string, string[]>[]
{
("MsgPack Files", new[] { $"*{FileEx.MPO}", }), ("Data Files", new[] { $"*{FileEx.DAT}", }),
//("All Files", new[] { "*", }),
};
}
else
{
fileTypes = null;
}
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new("MsgPack Files") {
Patterns = new[] { $"*.{FileEx.MPO}", },
//MimeTypes
//AppleUniformTypeIdentifiers =
},
new("Data Files") {
Patterns = new[] { $"*.{FileEx.DAT}", },
//MimeTypes
//AppleUniformTypeIdentifiers =
},
};
exportFile = await FilePicker2.SaveAsync(new PickOptions
{
FileTypes = fileTypes,
@@ -462,7 +461,13 @@ public static class AuthenticatorHelper
var options = new PickOptions();
if (!string.IsNullOrEmpty(fileExtension))
{
FilePickerFileType fileTypes = new[] { ($"{fileExtension} Files", new[] { "*" + fileExtension, }), };
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new($"{fileExtension} Files") {
Patterns = new[] { $"*.{fileExtension}", },
//MimeTypes
//AppleUniformTypeIdentifiers =
},
};
options.FileTypes = fileTypes;
}
var filePath = (await FilePicker2.PickAsync(options))?.FullPath;
@@ -207,8 +207,8 @@ internal sealed class AccountPlatformAuthenticatorRepository : Repository<Accoun
IsNotLocal = !isLocal,
IsNeedSecondaryPassword = !notSecondaryPassword,
Index = item.Index,
Created = item.Created,
LastUpdate = item.LastUpdate,
Created = item.Created == default ? DateTimeOffset.Now : item.Created,
LastUpdate = DateTimeOffset.Now,
};
return entity;
}
@@ -500,16 +500,13 @@ public sealed partial class AuthenticatorHomePageViewModel : ViewModelBase
if (Essentials.IsSupportedSaveFileDialog)
{
FilePickerFileType? fileTypes;
if (IApplication.IsDesktop())
{
fileTypes = new[] { ("maFile Files", new[] { FileEx.maFile, }), };
}
else
{
fileTypes = null;
}
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new("maFile Files") {
Patterns = new[] { $"*.{FileEx.maFile}", },
//MimeTypes
//AppleUniformTypeIdentifiers =
},
};
var exportFile = await FilePicker2.SaveAsync(new PickOptions
{
FileTypes = fileTypes,
@@ -563,7 +560,7 @@ public sealed partial class AuthenticatorHomePageViewModel : ViewModelBase
{
if (sender is not AuthenticatorItemModel authenticatorItemModel) return;
var index = Auths.IndexOf(authenticatorItemModel);
if (index > Auths.Count)
if (index >= Auths.Count - 1)
return;
if (authenticatorItemModel.AuthData.ServerId != null)
{
@@ -142,6 +142,7 @@ public sealed partial class SteamTradePageViewModel : WindowViewModel
Toast.Show(ToastIcon.Success, string.Format(Strings.Success_, Strings.User_Login));
_steamAuthenticator.SessionData = RemenberLogin ? _steamClient.Session.ToString() : null;
await AuthenticatorHelper.SaveAuthenticator(_authenticatorDto!);
_steamClient = _steamAuthenticator.GetClient(ResourceService.GetCurrentCultureSteamLanguageName());
await GetConfirmations(_steamClient);
}
else
@@ -185,12 +186,14 @@ public sealed partial class SteamTradePageViewModel : WindowViewModel
public async Task Logout()
{
if (_steamClient == null) return;
if (_steamClient == null || _steamAuthenticator == null) return;
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel() { Content = Strings.LocalAuth_LogoutTip, }, AppResources.Logout, isCancelButton: true,
isDialog: false))
{
_steamClient.Logout();
_steamAuthenticator.SessionData = null;
await AuthenticatorHelper.SaveAuthenticator(_authenticatorDto!);
IsLogged = false;
}
}
@@ -50,14 +50,14 @@
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE9D5;" />
</Viewbox>
</Button>
<Button
<!--<Button
Command="{Binding ShowDetailData}"
Theme="{StaticResource TransparentButton}"
ToolTip.Tip="{Binding Path=Res.ViewDetailedData, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Viewbox Width="20">
<ui:SymbolIcon Symbol="Calendar" />
</Viewbox>
</Button>
</Button>-->
<!--<Button
Command="{Binding ShowQrCode}"
Theme="{StaticResource TransparentButton}"
@@ -134,12 +134,12 @@
Source={x:Static s:ResourceService.Current}}" />-->
<!--<ui:MenuFlyoutItem Command="{Binding ShowRecoverWindow}" Text="{Binding Path=Res.Auth_Sync_Recover, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Command="{Binding ResetIndependentPassword}" Text="{Binding Path=Res.Auth_Sync_ResetPassword, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />-->
<ui:MenuFlyoutItem Text="{Binding Path=Res.Settings_Plugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<!--<ui:MenuFlyoutItem Text="{Binding Path=Res.Settings_Plugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />-->
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem IsEnabled="False" Text="{Binding Path=Res.Auth_Version, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{Binding Path=Res.ViewInStore, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<!--<ui:MenuFlyoutItem Text="{Binding Path=Res.ViewInStore, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{Binding Path=Res.UseHelp, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{Binding Path=Res.AboutThisPlugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{Binding Path=Res.AboutThisPlugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />-->
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
@@ -291,6 +291,14 @@
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource QrCode}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem
Command="{Binding ShowDetailData}"
CommandParameter="{Binding}"
Header="{Binding Path=Res.ViewDetailedData, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:SymbolIcon Symbol="Calendar" />
</MenuItem.Icon>
</MenuItem>
<MenuItem
Command="{Binding $parent[spp:PageBase].((spp:AuthenticatorHomePageViewModel)DataContext).DefaultExport}"
CommandParameter="{Binding}"
@@ -19,9 +19,7 @@
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Source={x:Static s:ResourceService.Current},
Path=Res.LocalAuth_ShowAuthInfo,
Mode=OneWay}"
Text="{Binding Source={x:Static s:ResourceService.Current}, Path=Res.LocalAuth_ShowAuthInfo, Mode=OneWay}"
TextTrimming="CharacterEllipsis" />
<ToggleButton x:Name="ShowDetail" VerticalAlignment="Center">
<ToggleButton.Content>
@@ -40,8 +38,7 @@
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding Source={x:Static s:ResourceService.Current},
Path=Res.LocalAuth_ShowSteamAuthTip2}"
Text="{Binding Source={x:Static s:ResourceService.Current}, Path=Res.LocalAuth_ShowSteamAuthTip2}"
TextWrapping="Wrap" />
</StackPanel>
</Border>
@@ -73,7 +70,6 @@
<TextBlock Text="{Binding Path=Res.LocalAuth_ShowSteamAuthTip1, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBox
Height="250"
AcceptsReturn="True"
IsReadOnly="True"
PasswordChar="{StaticResource PasswordChar}"
RevealPassword="{Binding #ShowDetail.IsChecked}"
@@ -12,7 +12,7 @@
x:CompileBindings="True"
x:DataType="spp:SteamTradePageViewModel"
mc:Ignorable="d">
<spp:ContentLoader IsLoading="{Binding IsLoading}">
<spp:ContentLoader CustomLoadingText="提示:不要忘了先开加速" IsLoading="{Binding IsLoading}">
<Panel>
<!-- 登录 -->
<StackPanel
@@ -17,9 +17,12 @@ public class PlatformSettingsPageViewModel : ViewModelBase
if (Platform is null)
return;
FilePickerFileType fileTypes = new ValueTuple<string, string[]>[]
{
(Platform.FullName, new[] { Platform.ExeName ?? "*" }),
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new(Platform.FullName) {
Patterns = new[] { Platform.ExeName ?? "*", },
//MimeTypes =
//AppleUniformTypeIdentifiers =
},
};
await FilePicker2.PickAsync((path) =>
@@ -258,6 +258,7 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
}
return;
}
Toast.Show(ToastIcon.Info, "图片下载需要一些时间,请稍后");
var imageHttpClientService = Ioc.Get<IImageHttpClientService>();
var stream = await imageHttpClientService.GetImageMemoryStreamAsync(SelectGrid.Url, default);
switch (type)
@@ -101,22 +101,22 @@
<TabItem Header="{Binding Path=Res.Media, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Panel>
<spp:ContentLoader
<DockPanel
x:Name="SteamGridDBContent"
MinWidth="300"
IsLoading="{Binding IsLoadingSteamGrid}"
IsShowNoResultText="{Binding IsSteamGridEmpty}"
IsVisible="False"
NoResultMessage="{Binding Path=Res.FailedGetImageFromSteamGridDB, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<DockPanel>
<Button
Height="30"
Margin="5,5,5,10"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Click="HideGridDialog_Click"
Content="{Binding Path=Res.Back, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
DockPanel.Dock="Top" />
IsVisible="False">
<Button
Height="30"
Margin="5,5,5,10"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Click="HideGridDialog_Click"
Content="{Binding Path=Res.Back, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
DockPanel.Dock="Top" />
<spp:ContentLoader
IsLoading="{Binding IsLoadingSteamGrid}"
IsShowNoResultText="{Binding IsSteamGridEmpty}"
NoResultMessage="{Binding Path=Res.FailedGetImageFromSteamGridDB, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ScrollViewer DockPanel.Dock="Bottom">
<ItemsControl
ItemsSource="{Binding SteamGridItems}"
@@ -166,8 +166,8 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DockPanel>
</spp:ContentLoader>
</spp:ContentLoader>
</DockPanel>
<ScrollViewer x:Name="MediaContent">
<StackPanel Classes="InfoBox">
@@ -117,11 +117,19 @@ public sealed partial class IdleAppsPageViewModel : ViewModelBase
private async Task SteamAppsSort()
{
if (IdleSequentital == IdleSequentital.Mostvalue)
Badges = await IdleCard.GetBadgesAsync(SteamConnectService.Current.CurrentSteamUser!.SteamId64.ToString(), true);
else
Badges = await IdleCard.GetBadgesAsync(SteamConnectService.Current.CurrentSteamUser!.SteamId64.ToString());
Badges = Badges.Where(x => x.CardsRemaining != 0); // 过滤可掉落卡片的游戏
try
{
if (IdleSequentital == IdleSequentital.Mostvalue)
Badges = await IdleCard.GetBadgesAsync(SteamConnectService.Current.CurrentSteamUser!.SteamId64.ToString(), true);
else
Badges = await IdleCard.GetBadgesAsync(SteamConnectService.Current.CurrentSteamUser!.SteamId64.ToString());
Badges = Badges.Where(x => x.CardsRemaining != 0); // 过滤可掉落卡片的游戏
}
catch (Exception ex)
{
Toast.LogAndShowT(ex);
return;
}
var appid_sorts = Enumerable.Empty<int>();
if (IdleSequentital == IdleSequentital.Default)
@@ -163,7 +171,10 @@ public sealed partial class IdleAppsPageViewModel : ViewModelBase
private void StartIdle()
{
if (!IdleGameList.Any())
{
IdleComplete();
return;
}
if (IdleRule == IdleRule.OnlyOneGame)
{
@@ -392,7 +403,7 @@ public sealed partial class IdleAppsPageViewModel : ViewModelBase
/// </summary>
private void IdleComplete()
{
MessageBox.Show(Strings.Idle_Complete, button: MessageBox.Button.OK);
Toast.Show(ToastIcon.Success, Strings.Idle_Complete);
}
#endregion
@@ -0,0 +1,53 @@
namespace BD.WTTS.Models;
public sealed class AvaloniaFilePickerFileTypeFilter : IFilePickerFileType
{
public IEnumerable<Item> Values { get; }
public AvaloniaFilePickerFileTypeFilter(
IEnumerable<Item> values)
{
Values = values;
}
public AvaloniaFilePickerFileTypeFilter(
params Item[] values)
{
Values = values;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator AvaloniaFilePickerFileTypeFilter(Item[] values) => new(values);
IEnumerable<string>? IFilePickerFileType.GetPlatformFileType(Platform platform)
{
foreach (var value in Values)
{
if (value.Patterns != null)
foreach (var item in value.Patterns)
yield return item;
if (value.MimeTypes != null)
foreach (var item in value.MimeTypes)
yield return item;
if (value.AppleUniformTypeIdentifiers != null)
foreach (var item in value.AppleUniformTypeIdentifiers)
yield return item;
}
}
public readonly record struct Item
{
public Item(string? name)
{
Name = name ?? string.Empty;
}
public string Name { get; }
public IReadOnlyList<string>? Patterns { get; init; }
public IReadOnlyList<string>? MimeTypes { get; init; }
public IReadOnlyList<string>? AppleUniformTypeIdentifiers { get; init; }
}
}
-9
View File
@@ -1,9 +0,0 @@
// ReSharper disable once CheckNamespace
namespace BD.WTTS;
#if DEBUG
[Obsolete("use ResourceService", true)]
public static class R
{
}
#endif
+9
View File
@@ -1052,6 +1052,15 @@ namespace BD.WTTS.Client.Resources {
}
}
/// <summary>
/// 查找类似 没有启用任何加速项!! 的本地化字符串。
/// </summary>
public static string CommunityFix_AccEmpty {
get {
return ResourceManager.GetString("CommunityFix_AccEmpty", resourceCulture);
}
}
/// <summary>
/// 查找类似 已加速 的本地化字符串。
/// </summary>
@@ -241,6 +241,9 @@
</data>
<data name="CommunityFix_ItemsEmpty" xml:space="preserve">
<value>获取加速信息失败,请检查程序是否能正常联网</value>
</data>
<data name="CommunityFix_AccEmpty" xml:space="preserve">
<value>没有启用任何加速项!!</value>
</data>
<data name="CommunityFix_AutoRunProxy" xml:space="preserve">
<value>启动时自动启动加速</value>
@@ -26,6 +26,8 @@ sealed class SteamServiceImpl2 : SteamServiceBaseImpl, ISteamConnectService
set => SteamConnectService.Current.IsConnectToSteam = value;
}
string? ISteamConnectService.SteamLanguageString => ResourceService.GetCurrentCultureSteamLanguageName();
SourceCache<SteamApp, uint> ISteamConnectService.SteamApps => SteamConnectService.Current.SteamApps;
SourceCache<SteamApp, uint> ISteamConnectService.DownloadApps => SteamConnectService.Current.DownloadApps;
@@ -55,7 +55,7 @@ public sealed class NoticeService : ReactiveObject
item.Unread = true;
//只弹最新的一条通知
if (UnreadNotificationsCount == 0 && GeneralSettings.MessagePopupNotification)
if (UnreadNotificationsCount == 0 && GeneralSettings.MessagePopupNotification.Value)
INotificationService.Instance.Notify(item.Content, NotificationType.Announcement, title: item.Title);
UnreadNotificationsCount++;
@@ -2,17 +2,17 @@ namespace BD.WTTS.Services;
public interface INavigationService
{
public static INavigationService Instance { get; } = Ioc.Get<INavigationService>();
static INavigationService Instance { get; } = Ioc.Get<INavigationService>();
public object? GetViewModelToPageContent(object viewModel, bool isCreateInstance = true);
object? GetViewModelToPageContent(object viewModel, bool isCreateInstance = true);
public void Navigate(Type? t, NavigationTransitionEffect effect = NavigationTransitionEffect.None);
void Navigate(Type? t, NavigationTransitionEffect effect = NavigationTransitionEffect.None, bool useCache = true);
public void GoBack();
void GoBack(Type? t = null);
public void NavigateFromContext(object dataContext, NavigationTransitionEffect transitionInfo = NavigationTransitionEffect.None);
void NavigateFromContext(object dataContext, NavigationTransitionEffect transitionInfo = NavigationTransitionEffect.None);
public void ShowControlDefinitionOverlay(Type targetType);
void ShowControlDefinitionOverlay(Type targetType);
public void ClearOverlay();
void ClearOverlay();
}
@@ -34,12 +34,6 @@ public sealed partial class SettingsPageViewModel : TabItemViewModel
SelectImage_Click = ReactiveCommand.CreateFromTask(async () =>
{
//FilePickerFileType fileTypes = new ValueTuple<string, string[]>[]
//{
// ("Image Files", FileEx.Images.Select(s => $"*{s}").ToArray()),
// //("All Files", new[] { "*", }),
//};
//await FilePicker2.PickAsync(SetBackgroundImagePath, fileTypes);
await FilePicker2.PickAsync(SetBackgroundImagePath, IFilePickerFileType.Images());
});
@@ -67,9 +61,12 @@ public sealed partial class SettingsPageViewModel : TabItemViewModel
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
public async void SelectSteamProgramLocation()
{
FilePickerFileType fileTypes = new ValueTuple<string, string[]>[]
{
("Steam", new[] { "steam.exe" }),
AvaloniaFilePickerFileTypeFilter fileTypes = new AvaloniaFilePickerFileTypeFilter.Item[] {
new("Steam") {
Patterns = new[] { "steam.exe", },
//MimeTypes =
//AppleUniformTypeIdentifiers =
},
};
await FilePicker2.PickAsync((path) =>
{
@@ -10,7 +10,7 @@ public partial class LoginOrRegisterWindowViewModel : WindowViewModel, SendSmsUI
{
Title = DisplayName;
Close = INavigationService.Instance.GoBack;
Close = () => INavigationService.Instance.GoBack(typeof(LoginOrRegisterWindowViewModel));
ChooseChannel = ReactiveCommand.CreateFromTask<string>(async channel_ =>
{