/// <summary> /// Initializes the LiveVideoControl web service. This is only called once, when the service is /// instantiated. /// </summary> /// <param name="train2groundClient">The T2G client to use local data store.</param> /// <param name="sessionManager">Manager for session.</param> /// <param name="requestProcessor">The request processor instance.</param> /// <param name="configuration">The configuration accessor instance.</param> public static void Initialize( IT2GManager train2groundManager, ISessionManagerExtended sessionManager, INotificationSender notificationSender, IRequestProcessor requestProcessor, ILiveVideoControlConfiguration configuration) { try { if (train2groundManager != null) { _t2gManager = train2groundManager; // Register a callback that will start streaming on new trains _t2gManager.SubscribeToElementChangeNotification( SubscriberId, new EventHandler <ElementEventArgs>(OnElementInfoChanged)); } if (sessionManager != null) { _sessionManager = sessionManager; } if (notificationSender != null) { _notificationSender = notificationSender; } if (requestProcessor != null) { _requestProcessor = requestProcessor; _requestProcessor.SetT2GManager(_t2gManager, ConfigurationSettings.AppSettings["ApplicationId"]); _requestProcessor.SetSessionMgr(_sessionManager); _requestProcessor.SetNotificationSender(_notificationSender); } if (configuration != null) { LoadConfiguration(configuration); } _initialized = true; } catch (System.Exception e) { LogManager.WriteLog(TraceType.ERROR, e.Message, "PIS.Ground.Maintenance.MaintenanceService.Initialize", e, EventIdEnum.LiveVideoControl); } }
/// <summary>Loads a configuration.</summary> /// <param name="configuration">The configuration accessor interface.</param> public static void LoadConfiguration(ILiveVideoControlConfiguration configuration) { if (configuration != null) { lock (_automaticModeLock) { LiveVideoControlService._configuration = configuration; if (string.IsNullOrEmpty(LiveVideoControlService._configuration.AutomaticModeURL)) { _isAutomaticMode = false; } else { _isAutomaticMode = true; ProcessAutomaticMode(LiveVideoControlService._configuration.AutomaticModeURL); } } } }