Пример #1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="parameters"></param>
        public void Startup(PluginStartupParameters parameters)
        {
            lock (_SyncLock) {
                var optionsStorage = new OptionsStorage();
                _Options = optionsStorage.Load(this);

                _Database = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database;
                _Database.FileNameChanging += BaseStationDatabase_FileNameChanging;
                _Database.FileNameChanged  += BaseStationDatabase_FileNameChanged;

                _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton;
                _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted;

                StartSession();

                // If we process messages on the same thread as IAutoConfigListener raises the message received event on then we
                // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many
                // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list
                // we create a background thread and process the messages on that.
                _BackgroundThreadMessageQueue = new BackgroundThreadQueue <BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue");
                _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught);
                var listener = Factory.Singleton.Resolve <IAutoConfigListener>().Singleton.Listener;
                listener.Port30003MessageReceived += MessageListener_MessageReceived;
                listener.SourceChanged            += MessageListener_SourceChanged;

                Factory.Singleton.Resolve <IHeartbeatService>().Singleton.SlowTick += Heartbeat_SlowTick;
            }
        }
Пример #2
0
        public void ReloadOptions()
        {
            var optionsStorage = new OptionsStorage();

            _Options = optionsStorage.Load();

            var configurationStorage = Factory.Singleton.Resolve <IConfigurationStorage>().Singleton;

            _Configuration = configurationStorage.Load();

            _View.CombinedFeeds.Clear();
            _View.CombinedFeeds.AddRange(
                _Configuration.Receivers.Select(r => new CombinedFeed()
            {
                UniqueId = r.UniqueId, Name = r.Name
            })
                .Concat(_Configuration.MergedFeeds.Select(r => new CombinedFeed()
            {
                UniqueId = r.UniqueId, Name = r.Name
            }))
                );

            _View.PluginEnabled = _Options.Enabled;
            _View.AllowUpdateOfOtherDatabases = _Options.AllowUpdateOfOtherDatabases;
            _View.DatabaseFileName            = _Configuration.BaseStationSettings.DatabaseFileName;
            _View.ReceiverId = _Options.ReceiverId;
            _View.SaveDownloadedAircraftDetails = _Options.SaveDownloadedAircraftDetails;
            _View.RefreshOutOfDateAircraft      = _Options.RefreshOutOfDateAircraft;

            RefreshWriteNotice();
        }
Пример #3
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="parameters"></param>
        public void Startup(PluginStartupParameters parameters)
        {
            Singleton = this;

            lock (_SyncLock) {
                var optionsStorage = new OptionsStorage();
                _Options = optionsStorage.Load();

                _Database = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database;
                _Database.FileNameChanging += BaseStationDatabase_FileNameChanging;
                _Database.FileNameChanged  += BaseStationDatabase_FileNameChanged;

                _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton;
                _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted;

                var feedManager = Factory.Singleton.Resolve <IFeedManager>().Singleton;
                feedManager.FeedsChanged += FeedManager_FeedsChanged;

                _OnlineLookupCache          = Provider.CreateOnlineLookupCache();
                _OnlineLookupCache.Database = _Database;
                _OnlineLookupCache.RefreshOutOfDateAircraft = _Options.RefreshOutOfDateAircraft;
                _OnlineLookupCache.EnabledChanged          += OnlineLookupCache_EnabledChanged;
                StartSession();

                var onlineLookupManager = Factory.Singleton.Resolve <IAircraftOnlineLookupManager>().Singleton;
                onlineLookupManager.RegisterCache(_OnlineLookupCache, 100, letManagerControlLifetime: false);

                // If we process messages on the same thread as the listener raises the message received event on then we
                // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many
                // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list
                // we create a background thread and process the messages on that.
                _BackgroundThreadMessageQueue = new BackgroundThreadQueue <BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue", 200000);
                _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught);

                HookFeed();

                _HeartbeatService           = Factory.Singleton.Resolve <IHeartbeatService>();
                _HeartbeatService.SlowTick += Heartbeat_SlowTick;
                _HeartbeatService.Start();
            }
        }
Пример #4
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="parameters"></param>
        public void Startup(PluginStartupParameters parameters)
        {
            lock(_SyncLock) {
                var optionsStorage = new OptionsStorage();
                _Options = optionsStorage.Load(this);

                _Database = Factory.Singleton.Resolve<IAutoConfigBaseStationDatabase>().Singleton.Database;
                _Database.FileNameChanging += BaseStationDatabase_FileNameChanging;
                _Database.FileNameChanged += BaseStationDatabase_FileNameChanged;

                _StandingDataManager = Factory.Singleton.Resolve<IStandingDataManager>().Singleton;
                _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted;

                StartSession();

                // If we process messages on the same thread as IAutoConfigListener raises the message received event on then we
                // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many
                // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list
                // we create a background thread and process the messages on that.
                _BackgroundThreadMessageQueue = new BackgroundThreadQueue<BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue");
                _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught);
                var listener = Factory.Singleton.Resolve<IAutoConfigListener>().Singleton.Listener;
                listener.Port30003MessageReceived += MessageListener_MessageReceived;
                listener.SourceChanged += MessageListener_SourceChanged;

                Factory.Singleton.Resolve<IHeartbeatService>().Singleton.SlowTick += Heartbeat_SlowTick;
            }
        }