private void LoadData() { foreach (string file in _files) { if (!File.Exists(file)) { continue; } DataGetter data = new DataGetter(file); Type t = data.GetTypeFromData(); if (t == typeof(CaseProgress)) { Progress.Add(file, (CaseProgress)data.ConvertToObject()); } if (t == typeof(CSIData)) { CSIData.Add(file, (CSIData)data.ConvertToObject()); } if (t == typeof(CurrentCaseData)) { CurrentData.Add(file, (CurrentCaseData)data.ConvertToObject()); } if (t == typeof(EntityData)) { EntityData.Add(file, (EntityData)data.ConvertToObject()); } if (t == typeof(EvidenceData)) { EvidenceData.Add(file, (EvidenceData)data.ConvertToObject()); } if (t == typeof(InterrogationData)) { InterrogationData.Add(file, (InterrogationData)data.ConvertToObject()); } if (t == typeof(SceneData)) { SceneData.Add(file, (SceneData)data.ConvertToObject()); } if (t == typeof(StageData)) { StageData.Add(file, (StageData)data.ConvertToObject()); } if (t == typeof(WrittenData)) { WrittenData.Add(file, (WrittenData)data.ConvertToObject()); } } }
//Call this method to update public void Update() { while (Empty == false) //Note - opportunity for efficiency... >:) { //step 1: Remove old data from the collections. lock (coinLock) { if (CurrentData != null && CurrentData.Count > 0) { //Step 1: Remove old data from the collections. CurrentData.TakeAndBreak(x => x.LastUpdate > DateTime.UtcNow.AddMinutes(-MinuteInterval)); //Step 2: Get new data from the database and add it to the collections. DataCalls.GetRecentCurrentData(Instrument.InstrumentID, MinuteInterval, CurrentDataIndex).ForEach(x => CurrentData.Add(x)); CurrentDataIndex = this.CurrentData.Max(x => x.CurrentID); } } lock (coinAggLock) { if (CurrentAggData != null && CurrentAggData.Count > 0) { CurrentAggData.TakeAndBreak(x => x.LastUpdate > DateTime.UtcNow.AddMinutes(-MinuteInterval)); DataCalls.GetRecentCurrentAggData(Instrument.InstrumentID, MinuteInterval, CurrentAggDataIndex).ForEach(x => CurrentAggData.Add(x)); CurrentAggDataIndex = this.CurrentAggData.Max(x => x.CurrentAggID); } } Thread.Sleep(50000); } }
/// <summary> /// /// </summary> /// <param name="data"></param> public static void SetData(FirmaDigitaleResultStatus data) { CurrentData.Add(data); HttpContext.Current.Session["FirmaDigitaleResultManager.CurrentData"] = CurrentData; }
/// <summary> /// /// </summary> /// <param name="data"></param> public static void SetData(DigitalSignatureResultStatus data) { CurrentData.Add(data); }
/// <summary> /// /// </summary> /// <param name="data"></param> public static void SetData(FirmaDigitaleResultStatus data) { CurrentData.Add(data); }