//List<Signal> signalList=new List<Signal>(); public DataProvider(string symbol) { this.symbol = (Symbol)Enum.Parse(typeof(Symbol), symbol); onFocus = true; currentTInterval = AppSetting.INTEVALS[0]; dataCache = new DataCache(this); //stat = new Stat(this); Register(); timerInit = new System.Timers.Timer(500); timerInit.Elapsed += new System.Timers.ElapsedEventHandler(CheckInitStatus); timerInit.AutoReset = true; timerInit.Enabled = true; timerInit.Stop(); timerAuto = new System.Timers.Timer(5000); timerAuto.Elapsed += new System.Timers.ElapsedEventHandler(Execute); timerAuto.AutoReset = true; timerAuto.Enabled = true; timerAuto.Stop(); }
public void Reconnect() { lock (this) { timerAuto.Stop(); Initialized = false; Initializing = false; initCdlStatus = DataInitStatus.NotStart; initRtdStatus = DataInitStatus.NotStart; cdlLoadingStatus = DownloadStatus.NotStart; rtdLoadingStatus = DownloadStatus.NotStart; //currentTInterval = AppSetting.INTEVALS[0]; isUpdateCandle = false; isAddCandle = false; if (dataCache != null) dataCache.CleanCache(); else dataCache = new DataCache(this); handler = new ProviderHandler(this); ProviderService.RegisterHandler(handler); dataCache.InitLocalData(); if (dataCache.DataUnits.ContainsKey(currentTInterval)) { List<BarData> datas = dataCache.DataUnits[currentTInterval]; Console.WriteLine(" datas count ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; " + datas.Count); if (datas.Count > 0) { localLastCdlTime = datas[datas.Count - 1].DateTime; hasLocalLastCdlTime = true; } } else { List<BarData> datas = new List<BarData>(); dataCache.DataUnits.Add(currentTInterval, datas); } ProviderService.KickOff(); } timerInit.Start(); //RaiseValuesUpdateEvent(UpdateType.NewBar, 1, 0); }