Esempio n. 1
0
        private void UpdateNewlyAddedStocks(object state)
        {
            DateTime      datenow = DateTime.UtcNow;
            StockRealTime sr      = new StockRealTime();
            StocksData    sd      = new StocksData();

            lock (_updateLock)
            {
                if (!_updating)
                {
                    _updating = true;

                    //Do Task
                    try
                    {
                        if ((datenow.Hour == 21 && datenow.Minute == 30) && (datenow.DayOfWeek != DayOfWeek.Saturday && datenow.DayOfWeek != DayOfWeek.Sunday))
                        {
                            sr.NotifyUser();
                        }


                        if (datenow.Hour == 3 && datenow.Minute == 30)
                        {
                            sd.GetDataAll();
                        }
                    }
                    catch
                    {
                    }
                    finally
                    {
                    }

                    _updating = false;
                }
            }
        }