public void Setup()
        {
            _versionHelper = new VersionHelper(new Version(1, 2, 3, 4));
            _gpoSettings   = Substitute.For <IGpoSettings>();

            _registry = Substitute.For <IRegistry>();
        }
        public void Setup()
        {
            _invoker = Substitute.For <IInteractionInvoker>();

            IStorage storage            = Substitute.For <IStorage>();
            var      pdfCreatorSettings = new PdfCreatorSettings();

            _gpoSettings = Substitute.For <IGpoSettings>();

            _simpleSettingsProvider = Substitute.For <ISettingsProvider>();
            _simpleSettingsProvider.Settings.Returns(pdfCreatorSettings);
            _settingsManager = Substitute.For <ISettingsManager>();
            _settingsManager.GetSettingsProvider().Returns(_simpleSettingsProvider);

            _iniSettingsAssitant = Substitute.For <IIniSettingsAssistant>();

            _commandLocator = Substitute.For <ICommandLocator>();

            _loadCommand = Substitute.For <ICommand>();
            _loadCommand.When(x => x.Execute(Arg.Any <object>())).Do(info => _iniSettingsAssitant.LoadIniSettings());
            _commandLocator.GetCommand <LoadIniSettingsCommand>().Returns(_loadCommand);

            _saveCommand = Substitute.For <ICommand>();
            _saveCommand.When(x => x.Execute(Arg.Any <object>())).Do(info => _iniSettingsAssitant.SaveIniSettings());
            _commandLocator.GetCommand <SaveSettingsToIniCommand>().Returns(_saveCommand);

            _translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());
        }
Exemple #3
0
        public AccountsViewModel(ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator, ITranslationUpdater translationUpdater, IDispatcher dispatcher, IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _currentSettingsProvider = currentSettingsProvider;
            _dispatcher  = dispatcher;
            _gpoSettings = gpoSettings;

            ConflateAllAccounts(_currentSettingsProvider.Settings);

            FtpAccountAddCommand    = commandLocator.GetCommand <FtpAccountAddCommand>();
            FtpAccountRemoveCommand = commandLocator.GetCommand <FtpAccountRemoveCommand>();
            FtpAccountEditCommand   = commandLocator.GetCommand <FtpAccountEditCommand>();

            SmtpAccountAddCommand    = commandLocator.GetCommand <SmtpAccountAddCommand>();
            SmtpAccountRemoveCommand = commandLocator.GetCommand <SmtpAccountRemoveCommand>();
            SmtpAccountEditCommand   = commandLocator.GetCommand <SmtpAccountEditCommand>();

            HttpAccountAddCommand    = commandLocator.GetCommand <HttpAccountAddCommand>();
            HttpAccountRemoveCommand = commandLocator.GetCommand <HttpAccountRemoveCommand>();
            HttpAccountEditCommand   = commandLocator.GetCommand <HttpAccountEditCommand>();

            DropboxAccountAddCommand    = commandLocator.GetCommand <DropboxAccountAddCommand>();
            DropboxAccountRemoveCommand = commandLocator.GetCommand <DropboxAccountRemoveCommand>();

            TimeServerAccountAddCommand    = commandLocator.GetCommand <TimeServerAccountAddCommand>();
            TimeServerAccountRemoveCommand = commandLocator.GetCommand <TimeServerAccountRemoveCommand>();
            TimeServerAccountEditCommand   = commandLocator.GetCommand <TimeServerAccountEditCommand>();

            if (_currentSettingsProvider != null)
            {
                _currentSettingsProvider.SelectedProfileChanged += CurrentSettingsProviderOnSelectedProfileChanged;
            }
        }
Exemple #4
0
        public DropboxUserControlViewModel(ITranslationUpdater translationUpdater,
                                           ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                           ICurrentSettingsProvider currentSettingsProvider,
                                           ICommandLocator commandLocator,
                                           ITokenViewModelFactory tokenViewModelFactory,
                                           IDispatcher dispatcher,
                                           IGpoSettings gpoSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _translationUpdater      = translationUpdater;
            _tokenViewModelFactory   = tokenViewModelFactory;
            _gpoSettings             = gpoSettings;
            AddDropboxAccountCommand = commandLocator.CreateMacroCommand()
                                       .AddCommand <DropboxAccountAddCommand>()
                                       .AddCommand(new DelegateCommand(SelectNewAccountInView))
                                       .Build();

            DropboxAccounts = accountsProvider?.Settings.DropboxAccounts;

            _translationUpdater.RegisterAndSetTranslation(tf =>
            {
                SharedFolderTokenViewModel = _tokenViewModelFactory
                                             .BuilderWithSelectedProfile()
                                             .WithSelector(p => p.DropboxSettings.SharedFolder)
                                             .WithDefaultTokenReplacerPreview(th => th.GetTokenListForDirectory())
                                             .Build();
            });
        }
 public void EditProfileIsGpoDisabled_GpoSettingsIsNull_SelectedProfileIsNull_ReturnsFalse()
 {
     _gpoSettings     = null;
     _selectedProfile = null;
     BuildProfilesViewModel();
     Assert.IsFalse(_profilesViewModel.EditProfileIsGpoDisabled);
 }
Exemple #6
0
        public HttpActionViewModel(ITranslationUpdater translationUpdater,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICommandLocator commandLocator,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _gpoSettings  = gpoSettings;
            _httpAccounts = accountsProvider?.Settings.HttpAccounts;
            if (_httpAccounts != null)
            {
                HttpAccountsView = new ListCollectionView(_httpAccounts);
                HttpAccountsView.SortDescriptions.Add(new SortDescription(nameof(HttpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            AddAccountCommand = commandLocator.CreateMacroCommand()
                                .AddCommand <HttpAccountAddCommand>()
                                .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                .Build();

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <HttpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();
        }
 public void RemoveProfileButtonIsGpoEnabled_GpoSettingsIsNull_SelectedProfileIsNull_ReturnsFalse()
 {
     _gpoSettings     = null;
     _selectedProfile = null;
     BuildProfilesViewModel();
     Assert.IsTrue(_profilesViewModel.RemoveProfileButtonIsGpoEnabled);
 }
        public void GPOIsNull_RequestUpdateIsEnabled_IsTrue()
        {
            _gpoSettings = null;
            var viewModel = BuildViewModel();

            Assert.IsTrue(viewModel.UpdateIsEnabled);
        }
        public FtpActionViewModel(ITranslationUpdater translationUpdater,
                                  ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                  ICurrentSettingsProvider currentSettingsProvider,
                                  ICommandLocator commandLocator,
                                  ITokenViewModelFactory tokenViewModelFactory,
                                  IDispatcher dispatcher,
                                  IGpoSettings gpoSettings)

            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _gpoSettings            = gpoSettings;
            DirectoryTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();

            _ftpAccounts = accountsProvider?.Settings.FtpAccounts;

            if (_ftpAccounts != null)
            {
                FtpAccountsView = new ListCollectionView(_ftpAccounts);
                FtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(FtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            AddAccountCommand = commandLocator.CreateMacroCommand()
                                .AddCommand <FtpAccountAddCommand>()
                                .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                .Build();

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <FtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();
        }
        public void SetSettingsAndRaiseNotifications(Conversion.Settings.ApplicationSettings applicationSettings, IGpoSettings gpoSettings)
        {
            ApplicationSettings = applicationSettings;
            GpoSettings         = gpoSettings;

            OnSettingsChanged();
        }
Exemple #11
0
 protected ADebugSettingsItemControlModel(ISettingsManager settingsManager, ITranslationUpdater translationUpdater, ICurrentSettingsProvider settingsProvider, IGpoSettings gpoSettings) : base(translationUpdater)
 {
     GpoSettings         = gpoSettings;
     SettingsManager     = settingsManager;
     SettingsProvider    = settingsProvider;
     ApplicationSettings = settingsProvider.Settings.ApplicationSettings;
 }
Exemple #12
0
 public HomeViewSettingsViewModel(ITranslationUpdater translationUpdater, ICurrentSettingsProvider settingsProvider,
                                  IGpoSettings gpoSettings, ICurrentSettings <RssFeed> rssFeedProvider, ICurrentSettings <ApplicationSettings> applicationsSettingsProvider)
     : base(translationUpdater, settingsProvider, gpoSettings)
 {
     _rssFeedProvider             = rssFeedProvider;
     _applicationSettingsProvider = applicationsSettingsProvider;
 }
        public void GpoSettingsIsNull_GetCurrentUpdateInterval_GetUpdateFromApplicationSettings()
        {
            _gpoSettings = null;

            var viewModel = BuildViewModel();

            Assert.AreEqual(viewModel.CurrentUpdateInterval, _currentSettings.Settings);
        }
Exemple #14
0
 public SharedSettingsLoader(IIniSettingsLoader iniSettingsLoader, IDirectory directory,
                             IGpoSettings gpoSettings, IProgramDataDirectoryHelper programDataDirectoryHelper)
 {
     _iniSettingsLoader          = iniSettingsLoader;
     _directory                  = directory;
     _gpoSettings                = gpoSettings;
     _programDataDirectoryHelper = programDataDirectoryHelper;
 }
Exemple #15
0
 public void Setup()
 {
     _activation       = new Activation();
     _activationHelper = Substitute.For <IActivationHelper>();
     _activationHelper.Activation.Returns(x => _activation);
     _interactionInvoker = Substitute.For <IInteractionInvoker>();
     _gpoSettings        = Substitute.For <IGpoSettings>();
 }
 public void Setup()
 {
     _activation     = new Activation(acceptExpiredActivation: true);
     _licenseChecker = Substitute.For <ILicenseChecker>();
     _licenseChecker.GetSavedActivation().Returns(x => _activation.SomeNotNull(LicenseError.NoActivation));
     _interactionInvoker = Substitute.For <IInteractionInvoker>();
     _gpoSettings        = Substitute.For <IGpoSettings>();
 }
 public LanguageSelectionSettingsViewModel(IGpoSettings gpoSettings, ICurrentSettingsProvider settingsProvider, ILanguageProvider languageProvider, ITranslationHelper translationHelper, ITranslationUpdater translationUpdater) :
     base(translationUpdater, settingsProvider, gpoSettings)
 {
     PreviewTranslationCommand = new DelegateCommand(ExecutePreviewTranslation);
     _translationHelper        = translationHelper;
     Languages = languageProvider.GetAvailableLanguages().ToList();
     SettingsProvider.SettingsChanged += (sender, args) => RaisePropertyChanged(nameof(CurrentLanguage));
 }
Exemple #18
0
        public PrintJobViewModel(
            ISettingsProvider settingsProvider,
            ITranslationUpdater translationUpdater,
            IJobInfoQueue jobInfoQueue,
            ICommandLocator commandLocator,
            IEventAggregator eventAggregator,
            ISelectedProfileProvider selectedProfileProvider,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profilesProvider,
            IGpoSettings gpoSettings,
            ITargetFilePathComposer targetFilePathComposer,
            IJobInfoManager jobInfoManager,
            IChangeJobCheckAndProceedCommandBuilder changeJobCheckAndProceedCommandBuilder,
            IBrowseFileCommandBuilder browseFileCommandBuilder,
            IDispatcher dispatcher,
            IJobDataUpdater jobDataUpdater)
            : base(translationUpdater)
        {
            GpoSettings              = gpoSettings;
            _settingsProvider        = settingsProvider;
            _commandLocator          = commandLocator;
            _eventAggregator         = eventAggregator;
            _selectedProfileProvider = selectedProfileProvider;
            _profilesProvider        = profilesProvider;
            _targetFilePathComposer  = targetFilePathComposer;
            _jobInfoManager          = jobInfoManager;

            _changeJobCheckAndProceedCommandBuilder = changeJobCheckAndProceedCommandBuilder;
            _dispatcher     = dispatcher;
            _jobDataUpdater = jobDataUpdater;
            _changeJobCheckAndProceedCommandBuilder.Init(() => Job, CallFinishInteraction, () => _lastConfirmedFilePath, s => _lastConfirmedFilePath = s);

            SetOutputFormatCommand = new DelegateCommand <OutputFormat>(SetOutputFormatExecute);

            browseFileCommandBuilder.Init(() => Job, UpdateUiForJobOutputFileTemplate, () => _lastConfirmedFilePath, s => _lastConfirmedFilePath = s);
            BrowseFileCommand = browseFileCommandBuilder.BuildCommand();
            SetupEditProfileCommand(_commandLocator, eventAggregator);

            SetupSaveCommands(translationUpdater);

            EmailCommand = _changeJobCheckAndProceedCommandBuilder.BuildCommand(EnableEmailSettings);
            SetupSendDropDownCommands(translationUpdater);

            MergeCommand = new DelegateCommand(MergeExecute);
            var mergeAllAsyncCommand = new AsyncCommand(MergeAllExecuteAsync, o => jobInfoQueue.Count > 1);

            MergeDropDownCommands = new CommandCollection <PrintJobViewTranslation>(translationUpdater);
            MergeDropDownCommands.AddCommand(mergeAllAsyncCommand, t => t.MergeAll);
            CancelCommand          = new DelegateCommand(CancelExecute);
            CancelDropDownCommands = new CommandCollection <PrintJobViewTranslation>(translationUpdater);
            CancelDropDownCommands.AddCommand(new DelegateCommand(CancelAllExecute, o => jobInfoQueue.Count > 1), t => t.CancelAll);

            DisableSaveTempOnlyCommand = new DelegateCommand(DisableSaveFileTemporary);

            jobInfoQueue.OnNewJobInfo += (sender, args) => UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);
            _jobInfoQueue              = jobInfoQueue;
            UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);
        }