private static void OnTimedEvent(Object source, ElapsedEventArgs e) { try { var service = new ServiceController("OpenALPRMilestone"); if (service != null) { if (service.Status != ServiceControllerStatus.Running) { Logger.Log.Info("starting OpenALPRMilestone service"); ServiceEvent?.Invoke(null, new MessageEventArgs($"{DateTime.Now.ToString()}: OpenALPR Milestone service was not running, restarted now.")); service.Start(); } } else { Logger.Log.Warn("service object is null"); } } catch (Exception ex) { Logger.Log.Error(null, ex); } }
/// <summary> /// Publish a service related event to the Disa Android client. /// /// IMPORTANT: Note that this is internal so that only the Disa.Framework assembly can call this function. /// </summary> /// <param name="eventAction">The type safe representation of the Event Action.</param> /// <param name="eventCategory">The type safe representation of the Event Category.</param> /// <param name="service">The <see cref="Service"/> to be associated with this Google Analytics event.</param> internal static void RaiseServiceEvent( EventAction eventAction, EventCategory eventCategory, Service service) { ServiceEvent?.Invoke(eventAction, eventCategory, service); }
public void FireServiceEvent() { ServiceEvent?.Invoke(); }