static void Main() { controller = new ControllerConnection(); ControllerCommands.TokenAuth(controller, reconect); ControllerCommands.StartLisen(controller); controller.On_Messege += OnMessage; controller.On_Exception += Controller_On_Exception; }
private static void Controller_On_Exception(object sender, EventArgs e) { Propities propities = new Propities(); reconect = true; controller.reconect = true; ControllerCommands.StopLisen(controller); Thread.Sleep((propities.GetControllerPropities().reconectTimeOut / 2) * 1000); Main(); }
public async Task Execute(IJobExecutionContext context) { JobDataMap dataMap = context.MergedJobDataMap; ControllerConnection controllerConnection = (ControllerConnection)dataMap.Get("controllerConnection"); /* * if (controllerConnection.reconect) * { * IScheduler schelduler = (IScheduler)dataMap.Get("schelduler"); * Propities.PauseScheldue(schelduler); * } else*/ ControllerCommands.Check(controllerConnection); }
public static void OnMessage(object sender, string m) { string[] marray = m.Split("\n"); if (marray[marray.Length - 1] == "") { marray = marray.Take(marray.Count() - 1).ToArray(); } foreach (string current in marray) { Console.WriteLine(DateTime.Now.ToShortTimeString() + " (SERVER): " + current); } if (m.StartsWith('{')) { ControllerCommands.Device(controller, m); } if (m == "authorization token not found\n") { ControllerCommands.TokenAuth(controller, reconect); } }