Пример #1
0
        /// <summary>
        /// Initialises the object.
        /// </summary>
        private void Initialise()
        {
            if (!_Initialised)
            {
                lock (_QueueLock) {
                    if (!_Initialised)
                    {
                        _Initialised = true;
                        QueueRepository.AddQueue(this);
                        _SharedConfiguration = Factory.Singleton.Resolve <ISharedConfiguration>().Singleton;
                        _Clock = Factory.Singleton.Resolve <IClock>();
                        _IsRunningUnderTestEnvironment = Factory.Singleton.Resolve <IRuntimeEnvironment>().Singleton.IsTest;

                        // Give plugins two ways to set the provider - either they can fetch the singleton for this
                        // object and set the provider to their own implementation or they can register their provider
                        // as the default implementation for IAircraftOnlineLookupProvider.
                        if (Provider == null)
                        {
                            Provider = Factory.Singleton.Resolve <IAircraftOnlineLookupProvider>();
                            CheckProviderSanity();
                        }
                        _SecondsToNextLookup = Provider.MinSecondsBetweenRequests;

                        var heartbeatService = Factory.Singleton.Resolve <IHeartbeatService>().Singleton;
                        heartbeatService.FastTick += Heartbeat_FastTick;
                    }
                }
            }
        }