添加修改轮询时间的功能
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user