Exemplo n.º 1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void ShowWinFormsOptionsUI()
        {
            using (var view = Provider.CreateOptionsView()) {
                var configurationStorage = Factory.Singleton.Resolve <IConfigurationStorage>().Singleton;
                var configuration        = configurationStorage.Load();

                view.PluginEnabled = _Options.Enabled;
                view.AllowUpdateOfOtherDatabases = _Options.AllowUpdateOfOtherDatabases;
                view.DatabaseFileName            = configuration.BaseStationSettings.DatabaseFileName;

                if (view.DisplayView())
                {
                    lock (_SyncLock) {
                        _Options.Enabled = view.PluginEnabled;
                        _Options.AllowUpdateOfOtherDatabases = view.AllowUpdateOfOtherDatabases;
                        var optionsStorage = new OptionsStorage();
                        optionsStorage.Save(this, _Options);

                        configuration.BaseStationSettings.DatabaseFileName = view.DatabaseFileName;
                        configurationStorage.Save(configuration);

                        bool optionsPermit = _Options.Enabled && (_Options.AllowUpdateOfOtherDatabases || DatabaseCreatedByPlugin());
                        if (_Session != null && !optionsPermit)
                        {
                            EndSession();
                        }
                        StartSession();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the user indicates that they want to save their changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void View_SaveClicked(object sender, EventArgs args)
        {
            _Options.Enabled = _View.PluginEnabled;
            _Options.AllowUpdateOfOtherDatabases = _View.AllowUpdateOfOtherDatabases;
            _Options.ReceiverId = _View.ReceiverId;
            _Options.SaveDownloadedAircraftDetails = _View.SaveDownloadedAircraftDetails;
            _Options.RefreshOutOfDateAircraft      = _View.RefreshOutOfDateAircraft;

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

            _Configuration.BaseStationSettings.DatabaseFileName = _View.DatabaseFileName;
            configurationStorage.Save(_Configuration);

            var optionsStorage = new OptionsStorage();

            optionsStorage.Save(_Options);
        }
Exemplo n.º 3
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void ShowWinFormsOptionsUI()
        {
            using(var view = Provider.CreateOptionsView()) {
                var configurationStorage = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton;
                var configuration = configurationStorage.Load();

                view.PluginEnabled = _Options.Enabled;
                view.AllowUpdateOfOtherDatabases = _Options.AllowUpdateOfOtherDatabases;
                view.DatabaseFileName = configuration.BaseStationSettings.DatabaseFileName;

                if(view.DisplayView()) {
                    lock(_SyncLock) {
                        _Options.Enabled = view.PluginEnabled;
                        _Options.AllowUpdateOfOtherDatabases = view.AllowUpdateOfOtherDatabases;
                        var optionsStorage = new OptionsStorage();
                        optionsStorage.Save(this, _Options);

                        configuration.BaseStationSettings.DatabaseFileName = view.DatabaseFileName;
                        configurationStorage.Save(configuration);

                        bool optionsPermit = _Options.Enabled && (_Options.AllowUpdateOfOtherDatabases || DatabaseCreatedByPlugin());
                        if(_Session != null && !optionsPermit) EndSession();
                        StartSession();
                    }
                }
            }
        }