mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
Merge pull request #3544 from BeyondDimension/feature/info_icon
✨ 网络测试页面延迟后增加info图标
This commit is contained in:
+16
-6
@@ -71,14 +71,24 @@
|
||||
Text="Beta" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Margin="0,0,4,0"
|
||||
HorizontalAlignment="Right"
|
||||
DockPanel.Dock="Right"
|
||||
Foreground="{Binding DelayColor}"
|
||||
Text="{Binding DelayMillseconds}"
|
||||
ToolTip.ShowDelay="0"
|
||||
ToolTip.Tip="此数值代表测试网页打开访问所需时间,请以实际浏览器访问网页状况为准" />
|
||||
DockPanel.Dock="Right">
|
||||
<TextBlock x:Name="DelayValue"
|
||||
Foreground="{Binding DelayColor}" VerticalAlignment="Center"
|
||||
Text="{Binding DelayMillseconds}" />
|
||||
|
||||
<ui:FontIcon
|
||||
Margin="3,0"
|
||||
FontSize="20"
|
||||
Glyph=""
|
||||
ToolTip.ShowDelay="0"
|
||||
ToolTip.Tip="此数值代表测试网页打开访问所需时间,请以实际浏览器访问网页状况为准"
|
||||
IsVisible="{Binding Text, ElementName=DelayValue, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
||||
</ui:FontIcon>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</TreeDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
|
||||
@@ -180,6 +180,17 @@ public sealed class ASFService : ReactiveObject
|
||||
ActionItem.Repo => "https://github.com/JustArchiNET/ArchiSteamFarm",
|
||||
ActionItem.Wiki => "https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Home-zh-CN",
|
||||
ActionItem.ConfigGenerator => "https://justarchinet.github.io/ASF-WebConfigGenerator",
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
if (url != string.Empty)
|
||||
{
|
||||
await Browser2.OpenAsync(url, BrowserLaunchMode.External);
|
||||
return;
|
||||
}
|
||||
|
||||
url = tag switch
|
||||
{
|
||||
ActionItem.WebConfig => IPCUrl + "/asf-config",
|
||||
ActionItem.WebAddBot => IPCUrl + "/bot/new",
|
||||
_ => IPCUrl,
|
||||
|
||||
+38
-3
@@ -1,3 +1,5 @@
|
||||
using FluentAvalonia.UI.Controls;
|
||||
|
||||
namespace BD.WTTS.UI.ViewModels;
|
||||
|
||||
public partial class ArchiSteamFarmExePathSettingsPageViewModel : ViewModelBase
|
||||
@@ -9,7 +11,7 @@ public partial class ArchiSteamFarmExePathSettingsPageViewModel : ViewModelBase
|
||||
public ArchiSteamFarmExePathSettingsPageViewModel()
|
||||
{
|
||||
SelectProgramPath = ReactiveCommand.Create(ASFService.Current.SelectASFProgramLocationAsync);
|
||||
DownloadASF = ReactiveCommand.Create(() =>
|
||||
DownloadASF = ReactiveCommand.Create(async () =>
|
||||
{
|
||||
if (INotificationService.Instance.IsSupportNotifyDownload)
|
||||
{
|
||||
@@ -19,8 +21,41 @@ public partial class ArchiSteamFarmExePathSettingsPageViewModel : ViewModelBase
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.Show(ToastIcon.Error, "当前平台无法调用下载通知,请自行下载", ToastLength.Short);
|
||||
var (downloadDialog, progress) = CreateDownloadDialog();
|
||||
ASFService.Current.DownloadASFAsync(progress: progress);
|
||||
_ = await downloadDialog.ShowAsync(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static (TaskDialog DownloadDialog, IProgress<float> Progress) CreateDownloadDialog()
|
||||
{
|
||||
var downloadDialog = new TaskDialog
|
||||
{
|
||||
Title = "下载插件",
|
||||
ShowProgressBar = true,
|
||||
IconSource = new SymbolIconSource { Symbol = Symbol.Download },
|
||||
SubHeader = "开始下载 ASF",
|
||||
Content = "正在初始化,请稍候",
|
||||
XamlRoot = AvaloniaWindowManagerImpl.GetWindowTopLevel(),
|
||||
// DownloadASFAsync() 无法取消后再次开启下载
|
||||
//Buttons = [new TaskDialogButton("取消", TaskDialogStandardResult.Cancel)],
|
||||
};
|
||||
downloadDialog.Opened += (_, _) => { downloadDialog.SetProgressBarState(0, TaskDialogProgressState.Normal); };
|
||||
|
||||
var progress = new Progress<float>();
|
||||
progress.ProgressChanged += (_, value) =>
|
||||
{
|
||||
// Value here report 1-100
|
||||
downloadDialog.Content = $"正在下载 {value}%";
|
||||
downloadDialog.SetProgressBarState(value, TaskDialogProgressState.Normal);
|
||||
|
||||
if (value >= 100)
|
||||
{
|
||||
downloadDialog.Hide();
|
||||
}
|
||||
};
|
||||
|
||||
return (downloadDialog, progress);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user