Skip to content

Commit d6de3ce

Browse files
committed
修复 第二次部署linux时卡住连接按钮的问题
1 parent 165c0db commit d6de3ce

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/ViewModels/VirtualMachinesPageViewModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public partial class VirtualMachinesPageViewModel : ObservableObject, IDisposabl
148148
[ObservableProperty] private bool _useSshProxy = false;
149149
[ObservableProperty] private string _sshProxyHost = "";
150150
[ObservableProperty] private string _sshProxyPort = "";
151+
private CancellationTokenSource? _gpuDeploymentCts;
151152

152153
// 日志与控制台
153154
[ObservableProperty] private string _gpuDeploymentLog = string.Empty;
@@ -3146,6 +3147,10 @@ private async Task SelectPartitionAndContinue(PartitionInfo partition)
31463147
[RelayCommand] // 之前缺失这个特性,导致按钮无效
31473148
private async Task StartLinuxDeploy()
31483149
{
3150+
_gpuDeploymentCts?.Cancel();
3151+
_gpuDeploymentCts = new CancellationTokenSource();
3152+
var token = _gpuDeploymentCts.Token;
3153+
31493154
// 1. 定位驱动安装任务项
31503155
var driveTask = GpuTasks.FirstOrDefault(t => t.TaskType == GpuTaskType.Driver);
31513156
if (driveTask == null) return;
@@ -3212,7 +3217,7 @@ private async Task StartLinuxDeploy()
32123217
}
32133218
AppendLog(msg);
32143219
},
3215-
CancellationToken.None
3220+
token
32163221
);
32173222

32183223
// 7. 流程结束判定
@@ -3343,6 +3348,10 @@ private void CopyToClipboard(string text)
33433348
[RelayCommand]
33443349
private async Task ResetGpuDeployment()
33453350
{
3351+
_gpuDeploymentCts?.Cancel();
3352+
_gpuDeploymentCts = new CancellationTokenSource();
3353+
IsLoadingSettings = false;
3354+
33463355
if (SelectedPartition != null)
33473356
{
33483357
// --- 场景 1: 软重置 ---

0 commit comments

Comments
 (0)