Exemple #1
0
 private void TISWebService_GetStateCompleted(object sender, GetStateCompletedEventArgs e)
 {
     try
     {
         //if (e.Error != null)
         //{
         //    throw new SLException(e.Error.Message + " DataProvider from server which failed");
         //}
         //if (!e.Result)
         //{
         //    throw new SLException(e.strError + " DataProvider from server");
         //}
         //if (this.OnData != null)
         //{
         TISWebServiceGetStateSupportOUT result               = DCSerializer.DeserializeWithDCS(typeof(TISWebServiceGetStateSupportOUT), e.strOut) as TISWebServiceGetStateSupportOUT;
         List <TrainWebData>             onlineTrains         = DCSerializer.DeserializeWithDCS(typeof(List <TrainWebData>), e.onlineTrainsData) as List <TrainWebData>;
         List <TrainWebData>             offlineTrains        = DCSerializer.DeserializeWithDCS(typeof(List <TrainWebData>), e.offlineTrainsData) as List <TrainWebData>;
         List <TrainWebData>             onlineButNotOnTheMap = DCSerializer.DeserializeWithDCS(typeof(List <TrainWebData>), e.onlineButNotOnTheMapTrainsData) as List <TrainWebData>;
         //this.OnData(result, onlineTrains, offlineTrains, onlineButNotOnTheMap);
         //this.AddLog("DataProvider GetStateCompleted");
         //}
     }
     //catch (SLException exception)
     //{
     //    this.DataError(exception.Message);
     //    this.AddLog("DataProvider GetState error custom: " + exception.Message);
     //}
     catch (Exception exception2)
     {
         //this.DataError(exception2.Message);
         //this.AddLog("DataProvider GetState error: " + exception2.Message);
     }
 }
Exemple #2
0
 private void TISWebService_GetStateCompleted(object sender, GetStateCompletedEventArgs e)
 {
     try
     {
         //if (e.Error != null)
         //{
         //    throw new SLException(e.Error.Message + " DataProvider from server which failed");
         //}
         //if (!e.Result)
         //{
         //    throw new SLException(e.strError + " DataProvider from server");
         //}
         //if (this.OnData != null)
         //{
             TISWebServiceGetStateSupportOUT result = DCSerializer.DeserializeWithDCS(typeof(TISWebServiceGetStateSupportOUT), e.strOut) as TISWebServiceGetStateSupportOUT;
             List<TrainWebData> onlineTrains = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.onlineTrainsData) as List<TrainWebData>;
             List<TrainWebData> offlineTrains = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.offlineTrainsData) as List<TrainWebData>;
             List<TrainWebData> onlineButNotOnTheMap = DCSerializer.DeserializeWithDCS(typeof(List<TrainWebData>), e.onlineButNotOnTheMapTrainsData) as List<TrainWebData>;
             //this.OnData(result, onlineTrains, offlineTrains, onlineButNotOnTheMap);
             //this.AddLog("DataProvider GetStateCompleted");
         //}
     }
     //catch (SLException exception)
     //{
     //    this.DataError(exception.Message);
     //    this.AddLog("DataProvider GetState error custom: " + exception.Message);
     //}
     catch (Exception exception2)
     {
         //this.DataError(exception2.Message);
         //this.AddLog("DataProvider GetState error: " + exception2.Message);
     }
 }
Exemple #3
0
 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;
 }
        /// <summary>
        /// Questo metodo viene invocato nel momento in cui è disponibile un risultato sulla verifica dello stato:
        /// se il task risulta completato, viene avviata la fase di recupero dei risultati, altrimenti si attende
        /// un'altra verifica.
        /// </summary>
        /// <param name="sender">l'oggetto che ha generato l'evento</param>
        /// <param name="args">informazioni aggiuntive sull'evento</param>
        private void Proxy_GetStateCompleted(object sender, GetStateCompletedEventArgs args)
        {
            if (HandleCancellationIfRequired(args.Cancelled)) return;
            if (HandleErrorIfRequired(args.Error)) return;

            TaskState ts = args.Result;
            switch (ts)
            {
                case TaskState.Completed:
                    BeginGetResults();
                    break;

                case TaskState.None:
                    BeginCloseProxy();
                    break;

                default:
                    BeginGetState();
                    break;
            }
        }