SoFunction
Updated on 2025-03-06

Simple example of C# timer timer update


class Program
    {

        static void Main(string[] args)
        {
            //for (int i = 0; i < 100; i++)
            //{

            //    SendMessage("13161626306", "13161626306");
            //}
            aTimer = new ();
            += new ElapsedEventHandler(aTimer_Elapsed);
// Set the time interval for triggering time. Set it to 1 second (1000 milliseconds)
= 300;  //Set the time interval
            = true;
("Press Enter to end the program");
(" Wait for the execution of the program......");
            ();

   
            //SendMessage("13161626306", "13161626306");
        }

        static void aTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            SendMessage("13161626306", "13161626306");
        }

     
        private static void SendMessage(string PhoneNum, string Message)
        {
            try
            {

 
                using ( sum = new ConsoleApplication1.())
                {
                   ok = new ConsoleApplication1.();

                        = Message;
                        = PhoneNum;

                        NewMessage = (ok);

 
                        ();
                        ("22");

                    //();
                }
            }
            catch(Exception e)
            {
                (());
                ();
            }
        }

    }