添加修改轮询时间的功能

This commit is contained in:
2025-07-05 16:13:46 +08:00
parent b019269bd7
commit d6939a7e66
9 changed files with 122 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
using HandyControl.Tools.Extension;
using iNKORE.UI.WPF.Modern.Controls;
using NPOI.SS.Formula.Functions;
using PMSWPF.Enums;
using PMSWPF.Models;
using PMSWPF.ViewModels.Dialogs;
using PMSWPF.Views.Dialogs;
@@ -158,4 +159,16 @@ public class DialogService :IDialogService
_ = dialog.ShowAsync(); // 不await让它在后台显示
return dialog;
}
public async Task<PollLevelType?> ShowPollLevelDialog(PollLevelType pollLevelType)
{
var vm = new PollLevelDialogViewModel(pollLevelType);
var dialog = new PollLevelDialog(vm);
var result = await dialog.ShowAsync();
if (result == ContentDialogResult.Primary)
{
return vm.SelectedPollLevelType;
}
return null;
}
}

View File

@@ -1,4 +1,5 @@
using iNKORE.UI.WPF.Modern.Controls;
using PMSWPF.Enums;
using PMSWPF.Models;
namespace PMSWPF.Services;
@@ -19,4 +20,6 @@ public interface IDialogService
Task<VariableData> ShowEditVarDataDialog(VariableData variableData);
Task<string> ShowImportExcelDialog();
ContentDialog ShowProcessingDialog(string title, string message);
Task<PollLevelType?> ShowPollLevelDialog(PollLevelType pollLevelType);
}

View File

@@ -222,7 +222,7 @@ namespace PMSWPF.Services
variable.DataValue = value.ToString();
variable.DisplayValue = SiemensHelper.ConvertS7Value(value, variable.DataType, variable.Converstion);
variable.LastPollTime = DateTime.Now; // 更新最后轮询时间
_logger.LogDebug($"线程ID{Environment.CurrentManagedThreadId},已读取变量 {variable.Name}: {variable.DataValue}");
// _logger.LogDebug($"线程ID{Environment.CurrentManagedThreadId},已读取变量 {variable.Name}: {variable.DataValue}");
}
}
catch (Exception ex)