共有变量添加

This commit is contained in:
hsc
2026-06-23 14:21:13 +08:00
parent 5b721d2557
commit cd3cbe7c35
11 changed files with 174 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
using Logger;
using MaterialDesignThemes.Wpf;
using Model.Models;
using Notifications.Wpf.Core;
using System.Collections.Concurrent;
using System.Diagnostics;
@@ -495,7 +496,15 @@ namespace ADP.ViewModels
targetContext.Program.Parameters.Clear();
targetContext.Program.StepCollection.Clear();
targetContext.Program.ErrorStepCollection.Clear();
foreach (var item in CurrentConfig.ParameterList)
{
var param = CurrentConfig.SharedParameterList.FirstOrDefault(x => x.ParameterName == item.Name);
if (param != null)
{
item.Value = param.Value;
}
targetContext.Program.Parameters.Add(item);
}
LoggerHelper.InfoWithNotify($"工位 [{runningScope}] 创建了空程序文件");
// 如果当前正看着该工位,刷新 UI 显示
@@ -552,6 +561,16 @@ namespace ADP.ViewModels
targetContext.Program.ErrorStepCollection = program.ErrorStepCollection;
targetContext.CurrentFilePath = filePath;
foreach (var item in CurrentConfig.SharedParameterList)
{
var parameter = targetContext?.Program?.Parameters?.FirstOrDefault(x => x.Name == item.ParameterName);
if (parameter != null)
{
parameter.Value = item.Value;
}
}
LoggerHelper.SuccessWithNotify($"工位 [{runningScope}] 成功打开文件: {filePath}");
// 💡 3. 安全调用异步复位,确保重置的是对应工位的数据