/// <summary> /// Stop Service /// </summary> protected override void OnStop() { try { if (device != null) { device.StopService(); device = null; } EventLog.WriteEntry("Shiol Service Stopped", EventLogEntryType.Information); } catch (Exception e) { EventLog.WriteEntry("Shiol Service Stopped ERR. " + e.Message, EventLogEntryType.Error); } try { if (serviceHost != null) { serviceHost.StopService(); } EventLog.WriteEntry("Web Service Stopped", EventLogEntryType.Information); } catch (Exception e) { EventLog.WriteEntry("Web Service Stopped ERR. " + e.Message, EventLogEntryType.Error); } }
public static int Main(String[] args) { ManagerDeviceProvider managerDevice = new ManagerDeviceProvider(); managerDevice.StartService(); Console.ReadKey(); managerDevice.StopService(); return(0); }
private HttpResponse processRequest(IHttpRequest req) { RestRequestParameters Parameters = new RestRequestParameters(); HttpRequestExtensions.RestRequest(req, Parameters); object obj = new JsonResponse(""); if (Parameters["trama"] != null) { ManagerDeviceProvider manager = new ManagerDeviceProvider(); manager.UDeviceProvider_OnDataReceived(Parameters["trama"]); LogFile.saveRegistro("SentByHand: " + Parameters["trama"], levels.debug); } if (Parameters["type"] != null && Parameters["type"] == "date") { obj = getShiolEvents(Parameters["date"]); } return(new JsonResponse(obj)); //new TextResponse(req.Query.GetValues(0).GetValue(0).ToString()); }
/// <summary> /// Start Service /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { try { device = new ManagerDeviceProvider(); device.StartService(); EventLog.WriteEntry("Shiol Service Started", EventLogEntryType.Information); } catch (Exception e) { EventLog.WriteEntry("Shiol Service Start ERR. " + e.Message, EventLogEntryType.Error); } try { serviceHost = new WebServerServiceProvider(); serviceHost.StartService(); EventLog.WriteEntry("Web Service Started", EventLogEntryType.Information); } catch (Exception e) { EventLog.WriteEntry("Web Service Start ERR. " + e.Message, EventLogEntryType.Error); } }