protected override void OnStop() { JLogger.LogInfo(this, "OnStop() Start"); base.OnStop(); if (_wl != null) { _wl.StopWatchers(); _wl = null; } JLogger.LogInfo(this, "OnStop() End"); }
public void Stop() { JLogger.LogInfo(this, "Stop() In"); //STOP COMMANDSERVICE if (_commandService != null) { _commandService.Close(); _commandService = null; } //STOP WATCHERS if (_watcherLoader != null) { _watcherLoader.StopWatchers(); _watcherLoader = null; } JLogger.LogInfo(this, "Stop() Out"); }
// ReSharper disable once UnusedParameter.Local private static void Main(string[] args) { //ENROLL MACHINE var hostName = Dns.GetHostName(); var ipHostInfo = Dns.GetHostEntry(hostName); var ipAddress = Convert.ToString(ipHostInfo.AddressList.FirstOrDefault(address => address.AddressFamily == AddressFamily.InterNetwork)); int id = ServerAccess.EnrollMachine(new Machine() { Ip = ipAddress, Name = hostName }); //GET CONFIGURATION //ENABLE WATCHERS var wl = new WatcherLoader(); wl.StartWatchers(); Console.WriteLine("Press Any Key to stop"); Console.ReadKey(); wl.StopWatchers(); }