public void ResetData() { this.m_stations.Clear(); this.m_regularCurves.Clear(); this.m_name2RealtimeCurve.Clear(); this.m_tgd = null; }
private void UpdateTrainGraphCache(TrainGraphData tgd, ClientServerInfo serverInfo) { this.m_trainGraphCache.Version = this.CacheVersion; this.m_trainGraphCache.CacheTime = DateTime.Now; this.m_trainGraphCache.TimeStart = tgd.TimeStart; this.m_trainGraphCache.TimeStop = tgd.TimeStop; if (tgd.Markers.Count > 0) { this.m_trainGraphCache.Markers = tgd.Markers; } if (tgd.Curves.Count > 0) { this.m_trainGraphCache.Curves = this.MergeCachedAndRealTimesCurves(this.m_trainGraphCache.Curves, tgd.Curves); } this.m_trainGraphCache.LastTrainGraphTime = serverInfo.LastTrainGraphTime; this.m_trainGraphCache.OperationDate = serverInfo.OperationDate; this.m_trainGraphCache.ServerTime = serverInfo.ServerTime; if (!this.m_trainGraphCache.Save()) { this.AddLog("TisMonitor did not save TrainGraphCache: " + this.m_trainGraphCache.LastError); IsolatedStorageHelper.IncreaseTo(10); } }
private void TrainGraphStateLoadFromCache(string version) { TrainGraphCache cache = new TrainGraphCache(); if (cache.Load(version)) { TrainGraphCache cache2 = cache; if (cache2 == null) { this.AddLog("TrainGraphCache was not loaded: Points.Cout == 0"); } else { this.m_needToFillTrainGraph = false; this.m_tgd = new TrainGraphData(); this.m_tgd.TimeStart = cache2.TimeStart; this.m_tgd.TimeStop = cache2.TimeStop; this.m_serverInfo.OperationDate = cache2.OperationDate; this.m_serverInfo.ServerTime = cache2.ServerTime; this.m_serverInfo.LastTrainGraphTime = cache2.LastTrainGraphTime; this.m_firstTrainGraphCache = cache2; } } else { this.AddLog("TrainGraphCache was not loaded: " + cache.LastError); } }
private void TISWebService_GetStateCompleted(object sender, GetStateCompletedEventArgs e) { try { if (e.Error != null) { throw new SLException(e.Error.Message + " TISMonitor from server which failed"); } if (!e.Result) { throw new SLException(e.strError + " TISMonitor from server"); } TISWebServiceGetStateSupportOUT tout = DCSerializer.DeserializeWithDCS(typeof(TISWebServiceGetStateSupportOUT), e.strOut) as TISWebServiceGetStateSupportOUT; this.m_serverInfo.LastTrainGraphTime = tout.actualRealTimeTrainGraphTime; this.m_serverInfo.ServerTime = tout.ServerTime; List<TrainWebData> onlineTrains = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.onlineTrainsData) as List<TrainWebData>; List<TrainWebData> onlineButOnTheMapTrains = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.onlineButNotOnTheMapTrainsData) as List<TrainWebData>; List<TrainWebData> offlineTrains = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.offlineTrainsData) as List<TrainWebData>; this.DrawTrains(onlineTrains, offlineTrains, onlineButOnTheMapTrains); TrainGraphData data = DCSerializer.DeserializeWithDCS(typeof(TrainGraphData), e.trainGraphData) as TrainGraphData; if (this.m_needToFillTrainGraph) { this.trainGraphControl.ResetData(); } bool needToFillTrainGraph = this.m_needToFillTrainGraph; bool flag2 = false; if (this.m_firstTrainGraphCache != null) { flag2 = true; needToFillTrainGraph = true; data.Curves = this.MergeCachedAndRealTimesCurves(this.m_firstTrainGraphCache.Curves, data.Curves); data.Markers.Clear(); data.Markers.AddRange(this.m_firstTrainGraphCache.Markers); this.m_firstTrainGraphCache = null; } this.m_tgd = data; this.trainGraphControl.TrainGraphData = this.m_tgd; this.trainGraphControl.ActualTime = this.m_serverInfo.ServerTime; this.trainGraphControl.Draw(needToFillTrainGraph); if (this.m_needToFillTrainGraph) { this.m_needToFillTrainGraph = false; } this.UpdateTrainGraphCache(this.m_tgd, this.m_serverInfo); this.UpdateTrainsCache(onlineTrains); this.SetOperationDate(tout.ServerOperationDate, !this.m_isFirstIteration || flag2); this.m_isFirstIteration = false; ErrorDlg.HelperClose(); } catch (SLException exception) { this.AddLog("TISMonitor GetState error custom: " + exception.Message); ErrorDlg.HelperShow("", exception.Message); } catch (Exception exception2) { this.AddLog("TISMonitor GetState error: " + exception2.Message); ErrorDlg.HelperShow("", exception2.Message); this.ResetTrainGraph(); } this.busyIndicator.IsBusy = false; this.m_bInsideTimerForTrains = false; }
private void ResetTrainGraph() { this.m_serverInfo = new ClientServerInfo(); this.m_tgd = null; this.m_needToFillTrainGraph = true; this.m_isFirstIteration = true; this.ResetTrainGraphCache(); }
public void ResetData() { this.m_stations.Clear(); this.m_regularCurves.Clear(); this.m_name2RealtimeCurve.Clear(); this.m_tgd = null; }