Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " : 프로그램 시작");
                if (tMainTimer == null)
                {
                    tMainTimer         = new MyThreadTimer(1000 * 60);
                    tMainTimer.OnTick += new MyThreadTimer.tick(tMainTimer_OnTick);
                    tMainTimer.Start();
                }

                while (true)
                {
                    System.Threading.Thread.Sleep(1000 * 60);
                    //System.Threading.Thread.CurrentThread.Join(1);
                    //System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
                    //Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("CybosPlusStarter", e.ToString());
            }
        }
Ejemplo n.º 2
0
        public void RequestStockData()
        {
            MyThreadTimer tStockMst  = null;
            MyThreadTimer tCpSvr8081 = null;
            MyThreadTimer tCpSvr7225 = null;

            try
            {
                //System.Timers.Timer tStockMst = new System.Timers.Timer();
                //tStockMst.AutoReset = true;
                //tStockMst.Elapsed += new ElapsedEventHandler(tStockMst_Elapsed);
                //tStockMst.Interval = 1000 * 60;
                //tStockMst.Start();

                if (StockCodes.Count > 0)
                {
                    tStockMst         = new MyThreadTimer(1000 * 60);
                    tStockMst.OnTick += new MyThreadTimer.tick(tStockMst_OnTick);
                    tStockMst.Start();
                }
                //System.Timers.Timer tCpSvr8081 = new System.Timers.Timer();
                //tCpSvr8081.AutoReset = true;
                //tCpSvr8081.Elapsed += new ElapsedEventHandler(tCpSvr8081_Elapsed);
                //tCpSvr8081.Interval = 1000 * 60;
                //tCpSvr8081.Start();

                if (StockCodes.Count == 0)
                {
                    tCpSvr8081         = new MyThreadTimer(1000 * 60);
                    tCpSvr8081.OnTick += new MyThreadTimer.tick(tCpSvr8081_OnTick);
                    tCpSvr8081.Start();
                }

                //System.Timers.Timer tCpSvr7225 = new System.Timers.Timer();
                //tCpSvr7225.AutoReset = true;
                //tCpSvr7225.Elapsed += new ElapsedEventHandler(tCpSvr7225_Elapsed);
                //tCpSvr7225.Interval = 1000 * 60;
                //tCpSvr7225.Start();

                if (StockCodes.Count == 0)
                {
                    tCpSvr7225         = new MyThreadTimer(1000 * 60);
                    tCpSvr7225.OnTick += new MyThreadTimer.tick(tCpSvr7225_OnTick);
                    tCpSvr7225.Start();
                }

                while (!selfKill)
                {
                    Thread.Sleep(1000 * 60);
                }

                if (tStockMst != null)
                {
                    tStockMst.Stop();
                }

                if (tCpSvr8081 != null)
                {
                    tCpSvr8081.Stop();
                }

                if (tCpSvr7225 != null)
                {
                    tCpSvr7225.Stop();
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("RequestStockRunner-RequestStockData", ex.ToString());
            }
        }