/// <summary> /// Saves the plugin's options. /// </summary> /// <param name="plugin"></param> /// <param name="options"></param> public void Save(Plugin plugin, Options options) { var storage = Factory.Singleton.Resolve<IPluginSettingsStorage>().Singleton; var pluginSettings = storage.Load(); pluginSettings.Write(plugin, EnabledField, options.Enabled); pluginSettings.Write(plugin, AllowUpdateOfOtherDatabasesField, options.AllowUpdateOfOtherDatabases); storage.Save(pluginSettings); }
/// <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; } }