/// <summary> /// Raises the <see cref="E:BatteryLow"/> event. /// </summary> /// <param name="e">The <see cref="LaJust.PowerMeter.Communications.BatteryLowEventArgs"/> instance containing the event data.</param> protected virtual void OnDeviceStatusUpdate(DeviceStatusEventData e) { EventHandler<DeviceStatusEventData> handler = DeviceStatusUpdate; try { handler(this, e); } catch (Exception ex) { Trace.TraceError("{0}.OnDeviceStatusUpdate: {1}", CLASSNAME, ex.GetBaseException()); } }
/// <summary> /// Handles the DeviceNotResponding event of the Receiver control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="LaJust.PowerMeter.Communications.DeviceNotRespondingEventArgs"/> instance containing the event data.</param> private void Receiver_DeviceStatusUpdate(object sender, DeviceStatusEventData e) { if (e.DeviceStatus != DeviceStatusEnum.NotResponding) { Helpers.ActivitySimulator.MoveMouse(); } _logger.Log("Publishing device status update event (" + e.DeviceId.ToString() + ") to EventAggregator", Category.Info, Priority.Low); _eventAggregator.GetEvent <ReceiverEvents.DeviceStatusUpdate>().Publish(new ReceiverEvents.DeviceStatusUpdate() { SensorId = e.DeviceId.ToString(), Status = (ReceiverEvents.SensorDeviceStatus)Enum.Parse(typeof(ReceiverEvents.SensorDeviceStatus), e.DeviceStatus.ToString(), true) }); }