コード例 #1
0
ファイル: T2GManager.cs プロジェクト: aioliaaiolos/PISGround
 /// <summary>Raises OnFilePublishedNotification.</summary>
 /// <param name="eventArgs">FilePublishedNotificationArgs object.</param>
 /// <returns>true if it succeeds, false if it fails.</returns>
 public void RaiseOnFilePublishedNotificationEvent(FilePublishedNotificationArgs eventArgs)
 {
     lock (_subscriberLock)
     {
         NotifyEventHandlersAsync(eventArgs, _filePublishedNotificationEventHandlers);
     }
 }
コード例 #2
0
 /// <summary>Raises the on file published notification event.</summary>
 /// <param name="args">The arguments.</param>
 public void RaiseOnFilePublishedNotificationEvent(FilePublishedNotificationArgs args)
 {
     if (_t2gManager != null)
     {
         _t2gManager.RaiseOnFilePublishedNotificationEvent(args);
     }
 }
コード例 #3
0
        /// <summary>Process Files Published Notification.</summary>
        /// <param name="folderId">folder id.</param>
        /// <param name="systemId">system id.</param>
        public void OnFilesPublishedNotification(int folderId, string systemId)
        {
            if (_fileDistributionManager != null)
            {
                lock (_lock)
                {
                    FilePublishedNotificationArgs objFilePublishedArgs = _fileDistributionManager.BuildFilePublishedNotificationArgs(folderId, systemId);

                    _notifierTarget.RaiseOnFilePublishedNotificationEvent(objFilePublishedArgs);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Callback called when a download folder is published on the train (signaled by the T2G client)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="status"></param>
        private static void OnFilesPublished(object sender, FilePublishedNotificationArgs status)
        {
            LogManager.WriteLog(TraceType.INFO, "OnFilesPublished called, folderId=" + status.FolderId + " systemId=" + status.SystemId, "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesPublished", null, EventIdEnum.InfotainmentJournaling);

            try
            {
                string      lGetFolderInformationError;
                IFolderInfo lFolderInfo = _t2gManager.T2GFileDistributionManager.GetRemoteFolderInformation(status.FolderId, status.SystemId, ConfigurationSettings.AppSettings["ApplicationId"], out lGetFolderInformationError);
                if (lFolderInfo != null)
                {
                    List <RecipientId> lRecipientIdList = new List <RecipientId>();

                    RecipientId lRecipient = new RecipientId();
                    lRecipient.ApplicationId = ConfigurationSettings.AppSettings["ApplicationId"];
                    lRecipient.MissionId     = string.Empty;
                    lRecipient.SystemId      = "ground";
                    lRecipientIdList.Add(lRecipient);

                    DownloadFolderRequest objRequest = new DownloadFolderRequest(
                        new Guid(lFolderInfo.FolderName),                   // The folder name should have the GUID-formatted name, this is our request ID
                        lFolderInfo.ExpirationDate,                         // Set to the folder's expiration date
                        lFolderInfo.FolderName,
                        lRecipientIdList,
                        DateTime.Now,                         //Start date: now
                        "InfotainmentJournaling Service Transfer Task",
                        FileTransferMode.AnyBandwidth,
                        16,                         //normal priority
                        new EventHandler <FileDistributionStatusArgs>(OnFilesDistribution),
                        status.FolderId);

                    objRequest.SystemId    = status.SystemId;
                    objRequest.Compression = false;

                    String lErrorMessage = _t2gManager.T2GFileDistributionManager.DownloadFolder(objRequest);
                    if (!String.IsNullOrEmpty(lErrorMessage))
                    {
                        LogManager.WriteLog(TraceType.ERROR, "T2G DownloadFolder failure, error " + lErrorMessage, "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesPublished", null, EventIdEnum.InfotainmentJournaling);
                    }
                }
                else
                {
                    LogManager.WriteLog(TraceType.ERROR, "Failure to retrieve folder info, error " + lGetFolderInformationError, "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesPublished", null, EventIdEnum.InfotainmentJournaling);
                }
            }
            catch (System.Exception e)
            {
                LogManager.WriteLog(TraceType.ERROR, "Exception thrown", "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesPublished", e, EventIdEnum.InfotainmentJournaling);
            }
        }