protected override void OnStart(string[] args)
        {
            eventLog1.WriteEntry("In OnStart.");
            // Set up a timer that triggers every minute.
            Timer timer = new Timer();

            timer.Interval = 300000; //
            timer.Elapsed += new ElapsedEventHandler(this.OnTimer);
            timer.Start();
            bool alert;
            var  myPairs = _cryptoServ.GetMyPairsInfo(out alert);
            var  emailTo = _mySettings.ReadSetting("emailTo");

            if (!_startChecking)
            {
                _startChecking = true;
                _logger.LogFile("Info: Start checking. Send email to: " + emailTo);
                var msg = _cryptoServ.GetInfoForEmail(myPairs);
                SendEmailAsync(emailTo, msg);
            }
        }
Beispiel #2
0
        // GET: Crypto
        public ActionResult Index()
        {
            CryptoInfoService cryptoServ = new CryptoInfoService();
            var  tradeInfo = cryptoServ.GetRecommendationInfo();
            bool alert;
            var  myPairs     = cryptoServ.GetMyPairsInfo(out alert);
            var  myPairsProc = cryptoServ.GetPairsProcessed();

            ViewBag.Trades      = tradeInfo;
            ViewBag.Pairs       = myPairs;
            ViewBag.PairsProc   = myPairsProc;
            ViewBag.Alert       = alert;
            ViewBag.UpdatedDate = tradeInfo.Count > 0 ? tradeInfo[0].UpdatedDate : DateTime.Now;

            return(View());
        }