/// <summary>
        /// Initializes a new instance of the OptionsViewPresenter class.
        /// </summary>
        /// <param name="optionsView">Options view.</param>
        /// <param name="mainView">Main view.</param>
        /// <param name="fileWatcherController">FileWatcherController.</param>
        /// <param name="applicationOptionsController">ApplicationOptionsController.</param>
        /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception>
        public OptionsViewPresenter(IOptionsView optionsView,
            IMainView mainView,
            FileWatcherController fileWatcherController,
            ApplicationOptionsController applicationOptionsController)
        {
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView",
                                                Resources.ArgumentNullException);
            }
            if (optionsView == null)
            {
                throw new ArgumentNullException("optionsView",
                                                Resources.ArgumentNullException);
            }
            if (fileWatcherController == null)
            {
                throw new ArgumentNullException("fileWatcherController",
                                                Resources.ArgumentNullException);
            }
            if (applicationOptionsController == null)
            {
                throw new ArgumentNullException("applicationOptionsController",
                                                Resources.ArgumentNullException);
            }

            _optionsView = optionsView;
            _mainView = mainView;
            _fileWatcherController = fileWatcherController;
            _applicationOptionsController = applicationOptionsController;

            SubscribeToMainViewEvents();
            SubscribeToOptionsViewEvents();
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="settingsService">The settings service.</param>
 public OptionsPresenter(
     IOptionsView view,
     ISettingsService settingsService)
 {
     this.view            = view;
     this.settingsService = settingsService;
 }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the PresenterBuilder class.
        /// </summary>
        /// <param name="mainView">IMainView.</param>
        /// <param name="logView">ILogView.</param>
        /// <param name="optionsView">IOptionsView.</param>
        /// <param name="propertiesView">IPropertiesView.</param>
        /// <exception cref="ArgumentNullException">mainView is null.</exception>
        /// <exception cref="ArgumentNullException">logView is null.</exception>
        /// <exception cref="ArgumentNullException">optionsView is null.</exception>
        /// <exception cref="ArgumentNullException">propertiesView is null.</exception>
        public PresenterBuilder(IMainView mainView,
                                ILogView logView,
                                IOptionsView optionsView,
                                IPropertiesView propertiesView)
        {
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView",
                                                Resources.ArgumentNullException);
            }
            if (logView == null)
            {
                throw new ArgumentNullException("logView",
                                                Resources.ArgumentNullException);
            }
            if (optionsView == null)
            {
                throw new ArgumentNullException("optionsView",
                                                Resources.ArgumentNullException);
            }
            if (propertiesView == null)
            {
                throw new ArgumentNullException("propertiesView",
                                                Resources.ArgumentNullException);
            }

            _viewType = ViewType.Forms;

            _mainView       = mainView;
            _logView        = logView;
            _optionsView    = optionsView;
            _propertiesView = propertiesView;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="settingsService">The settings service.</param>
 public OptionsPresenter(
     IOptionsView view,
     ISettingsService settingsService)
 {
     this.view = view;
     this.settingsService = settingsService;
 }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the OptionsViewPresenter class.
        /// </summary>
        /// <param name="optionsView">Options view.</param>
        /// <param name="mainView">Main view.</param>
        /// <param name="fileWatcherController">FileWatcherController.</param>
        /// <param name="applicationOptionsController">ApplicationOptionsController.</param>
        /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception>
        public OptionsViewPresenter(IOptionsView optionsView,
                                    IMainView mainView,
                                    FileWatcherController fileWatcherController,
                                    ApplicationOptionsController applicationOptionsController)
        {
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView",
                                                Resources.ArgumentNullException);
            }
            if (optionsView == null)
            {
                throw new ArgumentNullException("optionsView",
                                                Resources.ArgumentNullException);
            }
            if (fileWatcherController == null)
            {
                throw new ArgumentNullException("fileWatcherController",
                                                Resources.ArgumentNullException);
            }
            if (applicationOptionsController == null)
            {
                throw new ArgumentNullException("applicationOptionsController",
                                                Resources.ArgumentNullException);
            }

            _optionsView                  = optionsView;
            _mainView                     = mainView;
            _fileWatcherController        = fileWatcherController;
            _applicationOptionsController = applicationOptionsController;

            SubscribeToMainViewEvents();
            SubscribeToOptionsViewEvents();
        }
示例#6
0
 public IOptionsMgrPresenter Create(IOptionsMgr mgr, IOptionsView view)
 {
     IOptionsMgrPresenter presenter = null;
     if (mgr != null && view != null)
     {
         presenter = new OptionsMgrPresenter(mgr, view);
     }
     return presenter;
 }
示例#7
0
        public OptionsViewModel(IOptionsView view, IApplicationSettings applicationSettings)
        {
            this.view = view;
            this.applicationSettings = applicationSettings;
            view.Model = this;

            GenerateCommands();
            ReadSettings();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="settingsService">The settings service.</param>
 /// <param name="displayLogo">if set to <c>true</c> [display logo].</param>
 public OptionsPresenter(
     IOptionsView view,
     ISettingsService settingsService,
     bool displayLogo)
 {
     this.view            = view;
     this.settingsService = settingsService;
     this.displayLogo     = displayLogo;
 }
示例#9
0
        /// <summary>
        /// Initialises the presenter and the view.
        /// </summary>
        /// <param name="view"></param>
        public void Initialise(IOptionsView view)
        {
            _View = view;

            ReloadOptions();

            _View.CreateDatabaseClicked     += View_CreateDatabaseClicked;
            _View.PropertyChanged           += View_PropertyChanged;
            _View.SaveClicked               += View_SaveClicked;
            _View.UseDefaultFileNameClicked += View_UseDefaultFileNameClicked;
        }
示例#10
0
        public bool DoValidation(IOptionsView view)
        {
            var results = DoValidation(
                view.IsPluginEnabled,
                view.UseDefaultCacheFolder,
                view.CacheFolderOverride
                );

            view.ShowValidationResults(results);

            return(!results.HasErrors);
        }
        public OptionsPresenter(IOptionsView _view, Settings _settings)
        {
            this._view     = _view;
            this._settings = _settings;


            _view.PopulateLanguages(Settings.ListLang());

            _view.currentLanguage = _settings.Language;
            _view.writeLog        = _settings.WriteLog;

            _view.PropertyChanged += _view_PropertyChanged;
        }
示例#12
0
 public OptionsPresenter(IOptionsView view)
 {
     if (view == null) {
     throw new ArgumentNullException("view");
      }
      this.view = view;
      this.view.AboutVideCompressor += new EventHandler(view_AboutVideCompressor);
      this.view.Cancel += new EventHandler(view_Cancel);
      this.view.CompressorChanged += new EventHandler(view_CompressorChanged);
      this.view.ConfigureVideoCompressor += new EventHandler(view_ConfigureVideoCompressor);
      this.view.HelpRequest += new EventHandler(view_HelpRequested);
      this.view.Load += new EventHandler(view_Load);
      this.view.OK += new EventHandler(view_OK);
      this.view.SoundDeviceChanged += new EventHandler(view_SoundDeviceChanged);
      this.view.SoundFormatTagChanged += new EventHandler(view_SoundFormatTagChanged);
 }
示例#13
0
        public void Initialise(IOptionsView view)
        {
            _View = view;

            _View.SaveClicked  += View_SaveClicked;
            _View.ResetClicked += View_ResetClicked;
            _View.SelectedInjectSettingsChanged += View_SelectedInjectSettingsChanged;
            _View.ValueChanged                += View_ValueChanged;
            _View.NewInjectSettingsClicked    += View_NewInjectSettingsClicked;
            _View.DeleteInjectSettingsClicked += View_DeleteInjectSettingsClicked;

            if (_View.InjectSettings.Count > 0)
            {
                _View.SelectedInjectSettings = _View.InjectSettings[0];
            }
        }
示例#14
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="view"></param>
        public void Initialise(IOptionsView view)
        {
            _View = view;
            _View.ResetToDefaultsClicked                   += View_ResetToDefaultsClicked;
            _View.SaveClicked                              += View_SaveClicked;
            _View.TestConnectionClicked                    += View_TestConnectionClicked;
            _View.TestTextToSpeechSettingsClicked          += View_TestTextToSpeechSettingsClicked;
            _View.UseIcaoRawDecodingSettingsClicked        += View_UseIcaoRawDecodingSettingsClicked;
            _View.UseRecommendedRawDecodingSettingsClicked += View_UseRecommendedRawDecodingSettingsClicked;
            _View.ValuesChanged                            += View_ValuesChanged;

            _View.PopulateTextToSpeechVoices(Provider.GetVoiceNames());

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

            CopyConfigurationToUI(configuration);
        }
示例#15
0
 public OptionsPresenter(IOptionsView view)
 {
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     this.view = view;
     this.view.AboutVideCompressor += new EventHandler(view_AboutVideCompressor);
     this.view.Cancel                   += new EventHandler(view_Cancel);
     this.view.CompressorChanged        += new EventHandler(view_CompressorChanged);
     this.view.ConfigureVideoCompressor += new EventHandler(view_ConfigureVideoCompressor);
     this.view.HelpRequest              += new EventHandler(view_HelpRequested);
     this.view.Load += new EventHandler(view_Load);
     this.view.OK   += new EventHandler(view_OK);
     this.view.SoundDeviceChanged    += new EventHandler(view_SoundDeviceChanged);
     this.view.SoundFormatTagChanged += new EventHandler(view_SoundFormatTagChanged);
 }
示例#16
0
        private void Options()
        {
            RecordingState state = this.recorder.State;

            Debug.Assert(state == RecordingState.Idle);
            if (state != RecordingState.Idle)
            {
                return;
            }
            IOptionsView optionsView = ViewFactory.Create <IOptionsView>();

            optionsView.Configuration = this.configuration.Clone();
            if (optionsView.ShowDialog(this.view))
            {
                Configuration old = this.configuration;
                this.configuration = optionsView.Configuration;
                this.ApplyConfiguration(old);
            }
        }
        public OptionsPresenter(IOptionsView view, IVolumeMonitor volumeMonitor, ISettingsManager settings)
        {
            this.settings      = settings;
            this.view          = view;
            this.volumeMonitor = volumeMonitor;
            volumeStatusTimer  = new Timer
            {
                Interval = 100,
                Enabled  = true
            };
            volumeStatusTimer.Tick += volumeStatusTimer_Tick;

            view.MaxVolume   = volumeMonitor.MaxVolume;
            view.MaxLoudness = volumeMonitor.MaxLoudness;
            view.CultureCode = GetCurrentCultureCode();
            RefreshSoundMetrics();

            this.view.MaxVolumeChanged   += view_MaxVolumeChanged;
            this.view.MaxLoudnessChanged += view_MaxLoudnessChanged;
            this.view.CultureCodeChanged += view_CultureCodeChanged;
            this.view.Closed             += view_Closed;
        }
示例#18
0
        private void MainView_OptionsClick(object sender, EventArgs e)
        {
            _optionsView = _mainView.CreateOptionsView();
            _optionsView.NotCustomGameSelect   += OptionsView_NotCustomGameSelect;
            _optionsView.CustomGameSelect      += OptionsView_CustomGameSelect;
            _optionsView.ConfirmSelectionClick += OptionsView_ConfirmSelectionClick;
            GameType currentGameType = _gameManager.GetGameType();

            _optionsView.SetSelectedOption(currentGameType);
            if (currentGameType == GameType.Custom)
            {
                Options currentOptions = _gameManager.CurrentOptions;
                _optionsView.FieldWidth  = currentOptions.Width;
                _optionsView.FieldHeight = currentOptions.Height;
                _optionsView.Mines       = currentOptions.MinesAmount;
                _optionsView.EnableCustomValues(true);
            }
            else
            {
                _optionsView.EnableCustomValues(false);
            }
            _optionsView.ShowDialog();
        }
示例#19
0
        public void Initalize_Sets_URL_On_View()
        {
            MockRepository      repo                   = new MockRepository();
            IOptionsView        mockOptionsView        = repo.StrictMock <IOptionsView>();
            ISettingsOriginator mockSettingsOriginator = repo.StrictMock <ISettingsOriginator>();
            ISettingsMemento    mockSettingsMemento    = repo.StrictMock <ISettingsMemento>();
            ISetting            urlSetting             = repo.StrictMock <ISetting>();
            ISetting            userNameSetting        = repo.StrictMock <ISetting>();
            ISetting            passwordSetting        = repo.StrictMock <ISetting>();
            string url      = "http://www.google.com";
            string userName = "******";
            string password = "******";

            urlSetting.Expect(set => set.Value).Return(url);
            userNameSetting.Expect(set => set.Value).Return(userName);
            passwordSetting.Expect(set => set.Value).Return(password);

            mockSettingsOriginator.Expect(org => org.Get("TrackerURL")).Return(urlSetting);
            mockSettingsOriginator.Expect(org => org.Get("UserName")).Return(userNameSetting);
            mockSettingsOriginator.Expect(org => org.Get("Password")).Return(passwordSetting);
            mockSettingsOriginator.Expect(org => org.GetMemento()).Return(mockSettingsMemento);


            mockOptionsView.Expect(view => view.URL).SetPropertyWithArgument(url);
            mockOptionsView.Expect(view => view.UserName).SetPropertyWithArgument(userName);
            mockOptionsView.Expect(view => view.Password).SetPropertyWithArgument(password);

            repo.ReplayAll();

            IOptionsPresenter pres = new OptionsPresenter(mockOptionsView, mockSettingsOriginator);

            pres.Initalize();

            mockOptionsView.VerifyAllExpectations();
            mockSettingsOriginator.VerifyAllExpectations();
            urlSetting.VerifyAllExpectations();
        }
示例#20
0
 public OptionsController(IOptionsView view)
 {
     _view         = view;
     _view.Cancel += OnCancel;
     _view.Save   += OnSave;
 }
示例#21
0
        internal IOptionsMgrPresenter CreateOptionsMgrPresenter(IOptionsMgr mgr, IOptionsView view)
        {
            IOptionsMgrPresenter presenter = null;
            using (OptionsMgrPresenterFactory fac = new OptionsMgrPresenterFactory())
            {
                presenter = fac.Create(mgr, view);
            }

            return presenter;
        }
示例#22
0
 internal void _View_ResetItems(IOptionsView sender, ResetItemsEventArgs ea)
 {
     if (sender != null)
         ResetItems(ea.ItemNames);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 public OptionsPresenter(IOptionsView view)
     : this(view, new SettingsService())
 {
 }
示例#24
0
 public OptionsPresenter(IOptionsView view, [Named("Parameters")]ISettingsOriginator settings)
 {
     _view = view;
     _settings = settings;
 }
示例#25
0
 internal void _View_ApplyChanges(IOptionsView sender, ApplyChangesEventArgs ea)
 {
     if (sender != null)
         ApplyChanges(sender.Items);
 }
 public OptionsPresenter(IOptionsView view, [Named("Parameters")] ISettingsOriginator settings)
 {
     _view     = view;
     _settings = settings;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="displayLogo">if set to <c>true</c> [display logo].</param>
 public OptionsPresenter(IOptionsView view, bool displayLogo)
     : this(view, new SettingsService(), displayLogo)
 {
 }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OptionsPresenter" /> class.
 /// </summary>
 public OptionsPresenter(IOptionsView view)
     : this(view, new SettingsService())
 {
 }
示例#29
0
 public OptionsMgrPresenter(IOptionsMgr mgr, IOptionsView view)
 {
     View = view;
     Mgr = mgr;
 }
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="view"></param>
        public void Initialise(IOptionsView view)
        {
            _View = view;
            _View.ResetToDefaultsClicked += View_ResetToDefaultsClicked;
            _View.SaveClicked += View_SaveClicked;
            _View.TestConnectionClicked += View_TestConnectionClicked;
            _View.TestTextToSpeechSettingsClicked += View_TestTextToSpeechSettingsClicked;
            _View.UseIcaoRawDecodingSettingsClicked += View_UseIcaoRawDecodingSettingsClicked;
            _View.UseRecommendedRawDecodingSettingsClicked += View_UseRecommendedRawDecodingSettingsClicked;
            _View.ValuesChanged += View_ValuesChanged;

            _View.PopulateTextToSpeechVoices(Provider.GetVoiceNames());

            var configuration = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton.Load();
            CopyConfigurationToUI(configuration);
        }