private void UpdateChecker_Timer_Tick(object sender, EventArgs e) { try { string last_index = ctrl.read_index(); T_result new_massage = ctrl.get_update(last_index); BotStart_Botton.BackColor = Color.Green; BotStart_Botton.Text = "متصل شد "; if (new_massage.result.Count > 0) { Bot_Log(new_massage); ctrl.responce(new_massage); ctrl.save_index(ctrl.get_update()); } } catch (Exception ex) { UpdateChecker_Timer.Stop(); ReStartBot_timer.Start(); BotStart_Botton.BackColor = Color.Orange; BotStart_Botton.Enabled = true; BotStart_Botton.Text = "عدم اتصال"; warning_log(ex.Message); } }
static void Main(string[] args) { Controlls.SSL(); Controlls ctrl = new Controlls();//bot controller Console.WriteLine("Server Started "); while (true) { string last_index = ctrl.read_index(); T_result new_massage = ctrl.get_update(last_index); if (new_massage.result.Count > 0) { ctrl.responce(new_massage); ctrl.save_index(ctrl.get_update()); } } }