public override bool InitHandlers() { try { if (Sever.Handlers.InitHandlers.ValidationCyclic(Dictinory)) { var cyclicHandler = new HandlerCyclic(); //Добавляем к обработчику if (cyclicHandler.InitHandler(Dictinory, this)) { Handlers.Add(cyclicHandler); } } if (Sever.Handlers.InitHandlers.ValidationBackgroundInterrogation(Dictinory)) { var backgroundInterrogation = new HandlerDestinationBackgroundInterrogation(); //Добавляем к обработчику if (backgroundInterrogation.InitHandler(Dictinory, this)) { Handlers.Add(backgroundInterrogation); } } if (Sever.Handlers.InitHandlers.ValidationSpontaneous(Dictinory)) { var spontaneous = new HandlerDestinationSpontaneous(); //Добавляем к обработчику if (spontaneous.InitHandler(Dictinory, this)) { Handlers.Add(spontaneous); } } //Добавить обработчики IEC60870.ServerSetHandlers(); return(true); } catch { Log.Write(new Exception("IEC60870_Server.InitHandlers()"), Log.Code.ERROR); return(false); } }
public override bool Start() { try { //iec60870.ServerSetHandlers(); foreach (var handler in Handlers) { handler.Start(); } IsRun = IEC60870.ServerStart(); return(IsRun); } catch (Exception e) { Log.Write(e, Log.Code.ERROR); return(IsRun); } }
public override bool Stop() { IsRun = IEC60870.ServerStop(); return(!IsRun); }