mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
add 'Copy' Button to 'SettingPage - Device Id'
This commit is contained in:
@@ -2517,6 +2517,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 复制成功 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewModelSettingCopyDeviceIdSuccess {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewModelSettingCopyDeviceIdSuccess", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 设置数据目录成功,重启以应用更改 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -4002,6 +4011,15 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 复制 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string ViewPageSettingCopyDeviceIdAction {
|
||||
get {
|
||||
return ResourceManager.GetString("ViewPageSettingCopyDeviceIdAction", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 执行 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -936,6 +936,9 @@
|
||||
<data name="ViewModelSettingClearWebCacheSuccess" xml:space="preserve">
|
||||
<value>清除完成</value>
|
||||
</data>
|
||||
<data name="ViewModelSettingCopyDeviceIdSuccess" xml:space="preserve">
|
||||
<value>复制成功</value>
|
||||
</data>
|
||||
<data name="ViewModelSettingSetDataFolderSuccess" xml:space="preserve">
|
||||
<value>设置数据目录成功,重启以应用更改</value>
|
||||
</data>
|
||||
@@ -1431,6 +1434,9 @@
|
||||
<data name="ViewPageSettingCacheFolderHeader" xml:space="preserve">
|
||||
<value>打开 缓存 文件夹</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingCopyDeviceIdAction" xml:space="preserve">
|
||||
<value>复制</value>
|
||||
</data>
|
||||
<data name="ViewPageSettingDangerousAction" xml:space="preserve">
|
||||
<value>执行</value>
|
||||
</data>
|
||||
|
||||
@@ -92,6 +92,9 @@
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{Binding DeviceId}"/>
|
||||
</wsc:Setting.Description>
|
||||
<wsc:Setting.ActionContent>
|
||||
<Button Command="{Binding CopyDeviceIdCommand}" Content="{shcm:ResourceString Name=ViewPageSettingCopyDeviceIdAction}"/>
|
||||
</wsc:Setting.ActionContent>
|
||||
</wsc:Setting>
|
||||
<wsc:Setting
|
||||
Description="{Binding WebView2Version}"
|
||||
|
||||
@@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Windows.AppLifecycle;
|
||||
using Snap.Hutao.Core.Database;
|
||||
using Snap.Hutao.Core.IO;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Core.Setting;
|
||||
using Snap.Hutao.Core.Windowing;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
@@ -90,6 +91,7 @@ internal sealed class SettingViewModel : Abstraction.ViewModel
|
||||
ShowSignInWebViewDialogCommand = new AsyncRelayCommand(ShowSignInWebViewDialogAsync);
|
||||
SetDataFolderCommand = new AsyncRelayCommand(SetDataFolderAsync);
|
||||
ResetStaticResourceCommand = new RelayCommand(ResetStaticResource);
|
||||
CopyDeviceIdCommand = new RelayCommand(CopyDeviceId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,6 +228,11 @@ internal sealed class SettingViewModel : Abstraction.ViewModel
|
||||
/// </summary>
|
||||
public ICommand ResetStaticResourceCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 复制设备ID
|
||||
/// </summary>
|
||||
public ICommand CopyDeviceIdCommand { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Task OpenUIAsync()
|
||||
{
|
||||
@@ -321,4 +328,11 @@ internal sealed class SettingViewModel : Abstraction.ViewModel
|
||||
StaticResource.UnfulfillAllContracts();
|
||||
AppInstance.Restart(string.Empty);
|
||||
}
|
||||
|
||||
private void CopyDeviceId()
|
||||
{
|
||||
IInfoBarService infoBarService = serviceProvider.GetRequiredService<IInfoBarService>();
|
||||
Clipboard.SetText(DeviceId);
|
||||
infoBarService.Success(SH.ViewModelSettingCopyDeviceIdSuccess);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user