Ejemplo n.º 1
0
 // Invoke the Changed event; called whenever list changes
 protected virtual void OnChanged(RTPISDataStoreEventArgs e)
 {
     if (_changed != null)
     {
         _changed(this, e);
     }
 }
Ejemplo n.º 2
0
        /// <summary>Rtpis data store changed.</summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">Rtpis data store event information.</param>
        private static void RTPISDataStoreChanged(object sender, RTPISDataStoreEventArgs e)
        {
            ElementList <AvailableElementData> elementList = null;

            if (e != null)
            {
                // Skip the processing if PIS-Ground does not communicate with T2G.
                if (_t2gManager.T2GServerConnectionStatus)
                {
                    if (!string.IsNullOrEmpty(e.MissionCode))
                    {
                        T2GManagerErrorEnum rqstResult = _t2gManager.GetAvailableElementDataListByMissionCode(e.MissionCode, out elementList);

                        if (rqstResult == T2GManagerErrorEnum.eSuccess)
                        {
                            if (elementList != null)
                            {
                                foreach (var element in elementList)
                                {
                                    ProcessMissionDataSending(element.ElementNumber, e.MissionCode);
                                }
                            }
                        }
                        else
                        {
                            if (LogManager.IsTraceActive(TraceType.INFO))
                            {
                                LogManager.WriteLog(TraceType.INFO, string.Format(CultureInfo.CurrentCulture, Logs.INFO_NO_ELEMENTS_FOR_MISSION, e.MissionCode), "PIS.Ground.RealTime.RealTimeService.RTPISDataStoreChanged", null, EventIdEnum.RealTime);
                            }
                        }
                    }

                    string missionCode;
                    if (e.StationCodeList.HasValue &&
                        !string.IsNullOrEmpty((missionCode = e.StationCodeList.Value.Key)) &&
                        e.StationCodeList.Value.Value.Count > 0)
                    {
                        if (elementList == null)
                        {
                            T2GManagerErrorEnum rqstResult = _t2gManager.GetAvailableElementDataListByMissionCode(missionCode, out elementList);
                            if (rqstResult != T2GManagerErrorEnum.eSuccess && LogManager.IsTraceActive(TraceType.INFO))
                            {
                                LogManager.WriteLog(TraceType.INFO, string.Format(CultureInfo.CurrentCulture, Logs.INFO_NO_ELEMENTS_FOR_MISSION, missionCode), "PIS.Ground.RealTime.RealTimeService.RTPISDataStoreChanged", null, EventIdEnum.RealTime);
                            }
                        }

                        if (elementList != null)
                        {
                            foreach (var element in elementList)
                            {
                                ProcessStationDataSending(element.ElementNumber, e.StationCodeList.Value);
                            }
                        }
                    }
                }
                else if (LogManager.IsTraceActive(TraceType.DEBUG))
                {
                    LogManager.WriteLog(TraceType.DEBUG, Logs.SKIP_NOTIFICATION_RTPISDATASTORECHANGED_T2G_OFFLINE, "PIS.Ground.RealTime.RealTimeService.RTPISDataStoreChanged", null, EventIdEnum.RealTime);
                }
            }
        }