mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix #1087 and improve some null checks
This commit is contained in:
@@ -35,6 +35,11 @@ internal sealed partial class InvokeCommandOnLoadedBehavior : BehaviorBase<UIEle
|
||||
|
||||
private void TryExecuteCommand()
|
||||
{
|
||||
if (AssociatedObject is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (executed)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -16,6 +16,11 @@ internal sealed class OpenAttachedFlyoutAction : DependencyObject, IAction
|
||||
/// <inheritdoc/>
|
||||
public object Execute(object sender, object parameter)
|
||||
{
|
||||
if (sender is null)
|
||||
{
|
||||
return default!;
|
||||
}
|
||||
|
||||
FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement);
|
||||
return default!;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ internal sealed partial class SegmentedBar : ContentControl
|
||||
double offset = 0;
|
||||
foreach (ref readonly IColorSegment segment in CollectionsMarshal.AsSpan(list))
|
||||
{
|
||||
collection.Add(new GradientStop() { Color = segment.Color, Offset = offset, });
|
||||
collection.Add(new() { Color = segment.Color, Offset = offset, });
|
||||
offset += segment.Value / total;
|
||||
collection.Add(new GradientStop() { Color = segment.Color, Offset = offset, });
|
||||
collection.Add(new() { Color = segment.Color, Offset = offset, });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Snap.Hutao.Core.DependencyInjection;
|
||||
|
||||
@@ -108,7 +108,7 @@ internal sealed partial class GameAccountService : IGameAccountService
|
||||
public async ValueTask ModifyGameAccountAsync(GameAccount gameAccount)
|
||||
{
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
LaunchGameAccountNameDialog dialog = serviceProvider.CreateInstance<LaunchGameAccountNameDialog>();
|
||||
LaunchGameAccountNameDialog dialog = await contentDialogFactory.CreateInstanceAsync<LaunchGameAccountNameDialog>().ConfigureAwait(false);
|
||||
(bool isOk, string name) = await dialog.GetInputNameAsync().ConfigureAwait(true);
|
||||
|
||||
if (isOk)
|
||||
|
||||
@@ -16,30 +16,6 @@ namespace Snap.Hutao.Web;
|
||||
[SuppressMessage("", "SA1124")]
|
||||
internal static class ApiEndpoints
|
||||
{
|
||||
#region ApiGeetest
|
||||
|
||||
/// <summary>
|
||||
/// 获取GT码
|
||||
/// </summary>
|
||||
/// <param name="gt">gt</param>
|
||||
/// <returns>GT码Url</returns>
|
||||
public static string GeetestGetType(string gt)
|
||||
{
|
||||
return $"{ApiGeetest}/gettype.php?gt={gt}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证接口
|
||||
/// </summary>
|
||||
/// <param name="gt">gt</param>
|
||||
/// <param name="challenge">challenge流水号</param>
|
||||
/// <returns>验证接口Url</returns>
|
||||
public static string GeetestAjax(string gt, string challenge)
|
||||
{
|
||||
return $"{ApiV6Geetest}/ajax.php?gt={gt}&challenge={challenge}&lang=zh-cn&pt=3&client_type=web_mobile";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ApiTakumiAuthApi
|
||||
|
||||
/// <summary>
|
||||
@@ -397,9 +373,6 @@ internal static class ApiEndpoints
|
||||
#endregion
|
||||
|
||||
#region Hosts | Queries
|
||||
private const string ApiGeetest = "https://api.geetest.com";
|
||||
private const string ApiV6Geetest = "https://apiv6.geetest.com";
|
||||
|
||||
private const string ApiTakumi = "https://api-takumi.mihoyo.com";
|
||||
private const string ApiTakumiAuthApi = $"{ApiTakumi}/auth/api";
|
||||
private const string ApiTaKumiBindingApi = $"{ApiTakumi}/binding/api";
|
||||
|
||||
Reference in New Issue
Block a user