/// <summary> /// Прекратить поиск /// </summary> public static void StopComponentSearch() { if (string.IsNullOrEmpty(_contolInSearchGuid)) { return; } ControlEventBase ev = null; if (SoftDumpCache.ContainsKey(_contolInSearchGuid)) { ev = SoftDumpCache[_contolInSearchGuid]; } if (ev == null) { var hardware = ControlProcessorHardware.GenerateByGuid(_contolInSearchGuid); if (hardware.ModuleType == HardwareModuleType.BinaryOutput) { ev = new LampEvent { Hardware = hardware, IsOn = false }; } if (hardware.ModuleType == HardwareModuleType.Indicator || hardware.ModuleType == HardwareModuleType.LedMatrixIndicator) { ev = new IndicatorEvent { Hardware = hardware, IndicatorText = " " }; } } PostOutgoingSearchEvent(ev); _contolInSearchGuid = string.Empty; }
/// <summary> /// Отключить все устройства /// </summary> static public void Disconnect() { foreach (var hardware in Hardwares) { hardware.Disconnect(); } IncomingEvents.Clear(); SoftDumpCache.Clear(); }
public static void ResendLastControlEvent(string hardwareGuid) { var controlEvent = SoftDumpCache.FirstOrDefault(x => x.Key == hardwareGuid).Value; if (controlEvent == null) { return; } if (controlEvent.Hardware.ModuleType != HardwareModuleType.Axis && controlEvent.Hardware.ModuleType != HardwareModuleType.Button) { return; } lock (IncomingEvents) { IncomingEvents.Enqueue(controlEvent); } }