本文整理汇总了C#中IDataProvider.GetCurrentSystemState方法的典型用法代码示例。如果您正苦于以下问题:C# IDataProvider.GetCurrentSystemState方法的具体用法?C# IDataProvider.GetCurrentSystemState怎么用?C# IDataProvider.GetCurrentSystemState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataProvider
的用法示例。
在下文中一共展示了IDataProvider.GetCurrentSystemState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStateChanged
public void OnStateChanged(IDataProvider aDataProvider)
{
logger.Info("Уведомление о изменении состояния.");
if (!IsInitialized()) {
return;
}
try {
var currentSystemState = aDataProvider.GetCurrentSystemState();
if (IsEndOfScanning(currentSystemState)) {
endSlabScanTime = DateTime.Now;
if (endSlabScanTime - startSlabScanTime >= minimumScanTime) {
logger.Info("Время сканирования: " + (endSlabScanTime - startSlabScanTime));
var slabId = GetNewSlabId();
StoreSensorValues(slabId);
var slabModel = slabBuilder.BuildSlabModel(aIsUseFilters: true);
dimentionCalculator.CalculateDimentions(slabModel);
var dimentionValues = dimentionValueContainer.GetDimentionValues();
dimentionValueWriter.WriteDimentionValues(slabId, dimentionValues);
UpdateStandartSizeId(slabId, DetermineStandartSize(dimentionValues));
}
else {
logger.Info("Ложное срабатывание: сканирование длилось меньше временной отсечки.");
}
}
else { // начало сканирования.
startSlabScanTime = DateTime.Now;
}
lastSystemState = currentSystemState;
}
catch (Exception ex) {
logger.Info("Ошибка после завершения сканирования: " + ex.Message + "\n" +
"Stack trace: " + ex.StackTrace);
}
finally {
sensorValueContainer.Clear();
dimentionValueContainer.Clear();
}
}