public AccountsViewModel(
            ICurrentSettingsProvider currentSettingsProvider,
            ICurrentSettings <Conversion.Settings.Accounts> accountProvider,
            ICommandLocator commandLocator,
            ITranslationUpdater translationUpdater,
            IDispatcher dispatcher,
            IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _currentSettingsProvider = currentSettingsProvider;
            _dispatcher       = dispatcher;
            _gpoSettings      = gpoSettings;
            _accountsProvider = accountProvider;
            _commandLocator   = commandLocator;
            ConflateAllAccounts();

            FtpAccountAddCommand        = _commandLocator.GetCommand <FtpAccountAddCommand>();
            SmtpAccountAddCommand       = _commandLocator.GetCommand <SmtpAccountAddCommand>();
            HttpAccountAddCommand       = _commandLocator.GetCommand <HttpAccountAddCommand>();
            DropboxAccountAddCommand    = _commandLocator.GetCommand <DropboxAccountAddCommand>();
            TimeServerAccountAddCommand = _commandLocator.GetCommand <TimeServerAccountAddCommand>();

            RemoveSelectedAccountCommand = new DelegateCommand(OnRemoveSelectedCommand, CanRemoveSelectedCommand);

            EditSelectedAccountCommand = new DelegateCommand(OnEditSelectedCommand, CanEditSelectedCommand);

            AddAccountsToken = new List <AccountToken>
            {
                new AccountToken(SmtpAccountAddCommand, () => Translation.AddSmtpAccount, "EmailIcon"),
                new AccountToken(DropboxAccountAddCommand, () => Translation.AddDropboxAccount, "DropboxIcon"),
                new AccountToken(FtpAccountAddCommand, () => Translation.AddFtpAccount, "FtpIcon"),
                new AccountToken(HttpAccountAddCommand, () => Translation.AddHttpAccount, "HttpIcon"),
                new AccountToken(TimeServerAccountAddCommand, () => Translation.AddTimeServerAccount, "TimeServerIcon")
            };
        }
        public ProfilesViewModel(
            ISelectedProfileProvider selectedProfileProvider,
            ITranslationUpdater translationUpdater,
            ICommandLocator commandLocator,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profileProvider,
            IGpoSettings gpoSettings,
            IRegionManager regionManager,
            IWorkflowEditorSubViewProvider viewProvider,
            ICommandBuilderProvider commandBuilderProvider)
            : base(translationUpdater)
        {
            _profileProvider = profileProvider;
            _regionManager   = regionManager;
            _viewProvider    = viewProvider;

            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();

            var macroCommandBuilder = commandBuilderProvider.ProvideBuilder(commandLocator);

            ProfileAddCommand = macroCommandBuilder
                                .AddCommand <ProfileAddCommand>()
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.OutputFormatOverlay, t => t.OutputFormat))
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.SaveOverlay, t => t.Save))
                                .Build();
        }
        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 #4
0
        public IMacroCommandBuilder AddCommand <T>() where T : class, ICommand
        {
            var command = _commandLocator?.GetCommand <T>();

            AddCommand(command);
            return(this);
        }
Exemple #5
0
 public ExportSettingsViewModel(
     ITranslationUpdater translationUpdater,
     ICommandLocator commandLocator,
     IGpoSettings gpoSettings) : base(translationUpdater, gpoSettings)
 {
     LoadIniSettingsCommand = commandLocator.GetCommand <LoadIniSettingsCommand>();
     SaveIniSettingsCommand = commandLocator.GetCommand <SaveSettingsToIniCommand>();
 }
        public ProfilesViewModel(ISelectedProfileProvider selectedProfileProvider, ITranslationUpdater translationUpdater, ICommandLocator commandLocator, ISettingsProvider settingsProvider, ICurrentSettings <ObservableCollection <ConversionProfile> > profileProvider, IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _settingsProvider       = settingsProvider;
            _profileProvider        = profileProvider;
            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileAddCommand    = commandLocator.GetCommand <ProfileAddCommand>();
            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();
        }
        public TitleReplacementsViewModel(ITranslationUpdater translationUpdater, ICurrentSettings <ObservableCollection <TitleReplacement> > titleReplacementProvider, ICurrentSettingsProvider settingsProvider, ICommandLocator commandLocator, IGpoSettings gpoSettings) : base(translationUpdater)
        {
            _titleReplacementProvider = titleReplacementProvider;
            _settingsProvider         = settingsProvider;
            GpoSettings        = gpoSettings;
            TitleAddCommand    = commandLocator.GetCommand <TitleReplacementAddCommand>();
            TitleDeleteCommand = commandLocator.GetCommand <TitleReplacementRemoveCommand>();
            TitleEditCommand   = commandLocator.GetCommand <TitleReplacementEditCommand>();

            if (TitleReplacements != null)
            {
                UpdateTitleReplacements();
            }
        }
Exemple #8
0
        public byte[] Process(byte[] data)
        {
            object result;

            try {
                var requestName = _requestParser.GetRequestName(data);
                var command     = _commandLocator.GetCommand(requestName);
                if (command == null)
                {
                    throw new ProcessException(string.Format("The request '{0}' is unknown.", requestName));
                }
                result = ExecuteCommand(command, data);
            }
            catch (TargetInvocationException ex) {
                result = new ErrorResponse {
                    Error = ex.InnerException.Message
                };
            }
            catch (Exception ex) {
                result = new ErrorResponse {
                    Error = ex.Message
                };
            }
            return(_requestParser.ConvertToBytes(result));
        }
        public NotificationService(ITranslationFactory translationFactory, IThreadManager threadManager, ICommandLocator commandLocator)
        {
            _translationFactory = translationFactory;
            _threadManager      = threadManager;

            _openDocumentInExplorerCommand = commandLocator.GetCommand <QuickActionOpenExplorerLocationCommand>();
        }
Exemple #10
0
        protected override void DoWorkflowWork(Job job)
        {
            job.OutputFileTemplate = _targetFilePathComposer.ComposeTargetFilePath(job);

            if (job.Profile.SkipPrintDialog)
            {
                if (_interactiveProfileChecker.CheckWithErrorResultInWindow(job))
                {
                    _commandLocator.GetCommand <SkipPrintDialogCommand>().Execute(job);
                }
                else
                {
                    //Enable PrintJobView for invalid profiles
                    job.Profile.SkipPrintDialog = false;
                }
            }

            _logger.Debug("Starting PrintJobWindow");

            try
            {
                _shellManager.ShowPrintJobShell(job);
                _settingsProvider.Settings.CreatorAppSettings.LastUsedProfileGuid = job.Profile.Guid;

                if (job.IsSuccessful)
                {
                    _lastSaveDirectoryHelper.Save(job);
                }
            }
            finally
            {
                _directoryHelper.DeleteCreatedDirectories();
            }
        }
        public void Init <TTranslation>(Func <TTranslation, string> titleId, Func <ConversionProfile, IProfileSetting> setting, PrismNavigationValueObject navigationObject, Func <ConversionProfile, bool> hasNotSupportedFeatures = null) where TTranslation : ITranslatable, new()
        {
            _setting = setting;

            _addActionCommand    = _commandLocator?.GetCommand <AddActionCommand>();
            _removeActionCommand = _commandLocator?.GetCommand <RemoveActionCommand>();

            _hasNotSupportedFeatures = hasNotSupportedFeatures ?? (p => false);
            _navigationObject        = navigationObject;

            _translationUpdater.RegisterAndSetTranslation(tf =>
            {
                var translation = tf.UpdateOrCreateTranslation((TTranslation)_translation);
                _translation    = translation;
                Title           = titleId(translation);
            });
        }
Exemple #12
0
        public TitleReplacementsViewModel(ITranslationUpdater transalationUpdater, ICurrentSettingsProvider settingsProvider, ICommandLocator commandLocator, IGpoSettings gpoSettings) : base(transalationUpdater)
        {
            _settingsProvider  = settingsProvider;
            GpoSettings        = gpoSettings;
            TitleAddCommand    = commandLocator.GetCommand <TitleReplacementAddCommand>();
            TitleDeleteCommand = commandLocator.GetCommand <TitleReplacementRemoveCommand>();
            TitleEditCommand   = commandLocator.GetCommand <TitleReplacementEditCommand>();

            if (_settingsProvider.Settings != null)
            {
                UpdateTitleReplacements();
            }

            _settingsProvider.SettingsChanged += (sender, args) => UpdateTitleReplacements();

            TitleReplacements.CollectionChanged += TitleReplacementsOnCollectionChanged;
        }
Exemple #13
0
        public void Initialize_CommandLocatorSetsPrioritySupportCommand()
        {
            var openPriortiySupportUrlCommand = Substitute.For <ICommand>();

            _commandLocator.GetCommand <PrioritySupportUrlOpenCommand>().Returns(openPriortiySupportUrlCommand);
            InitAboutViewModel();
            Assert.AreSame(openPriortiySupportUrlCommand, _aboutViewModel.PrioritySupportCommand);
        }
        public ProfilesViewModel(ISelectedProfileProvider selectedProfileProvider, ITranslationUpdater translationUpdater, ICommandLocator commandLocator, ISettingsProvider settingsProvider, IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _settingsProvider       = settingsProvider;
            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileAddCommand    = commandLocator.GetCommand <ProfileAddCommand>();
            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();

            if (selectedProfileProvider != null)
            {
                selectedProfileProvider.SettingsChanged        += OnProfilesChanged;
                selectedProfileProvider.SelectedProfileChanged += (s, args) => RaisePropertyChanged(nameof(SelectedProfile));
            }
        }
Exemple #15
0
        public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater, EditionHintOptionProvider editionHintOptionProvider)
            : base(translationUpdater)
        {
            AllowPrioritySupport = !editionHintOptionProvider?.ShowOnlyForPlusAndBusinessHint ?? true;

            WhatsNewCommand        = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew);
            BlogCommand            = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.Blog);
            PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>();
        }
        public SignatureUserControlViewModel(
            IOpenFileInteractionHelper openFileInteractionHelper, EditionHelper editionHelper,
            ICurrentSettings <Conversion.Settings.Accounts> accountsProvider, ITranslationUpdater translationUpdater,
            ICurrentSettingsProvider currentSettingsProvider,
            ICommandLocator commandLocator, ISignaturePasswordCheck signaturePasswordCheck,
            IFile file, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher,
            IGpoSettings gpoSettings, ISigningPositionToUnitConverterFactory signingPositionToUnitConverter,
            ICurrentSettings <ApplicationSettings> applicationSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _commandLocator            = commandLocator;

            _signaturePasswordCheck = signaturePasswordCheck;
            _file        = file;
            _gpoSettings = gpoSettings;

            _signingPositionToUnitConverter = signingPositionToUnitConverter;
            ApplicationSettings             = applicationSettings;
            UnitConverter = _signingPositionToUnitConverter?.CreateSigningPositionToUnitConverter(UnitOfMeasurement.Centimeter);

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels(tokenViewModelFactory));
            currentSettingsProvider.SelectedProfileChanged += (sender, args) => SetTokenViewModels(tokenViewModelFactory);

            if (editionHelper != null)
            {
                OnlyForPlusAndBusiness = editionHelper.ShowOnlyForPlusAndBusiness;
            }

            _timeServerAccounts = accountsProvider?.Settings.TimeServerAccounts;
            if (_timeServerAccounts != null)
            {
                TimeServerAccountsView = new ListCollectionView(_timeServerAccounts);
                TimeServerAccountsView.SortDescriptions.Add(new SortDescription(nameof(TimeServerAccount.AccountInfo), ListSortDirection.Ascending));
            }

            ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute);

            ChangeUnitConverterCommand = new DelegateCommand(ChangeUnitConverterExecute);

            if (Signature != null)
            {
                AskForPasswordLater = string.IsNullOrEmpty(Password);
            }

            _timeServerAccountEditCommand = _commandLocator.GetCommand <TimeServerAccountEditCommand>();

            AddTimeServerAccountCommand = _commandLocator.CreateMacroCommand()
                                          .AddCommand <TimeServerAccountAddCommand>()
                                          .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                          .Build();

            EditTimeServerAccountCommand = _commandLocator.CreateMacroCommand()
                                           .AddCommand(_timeServerAccountEditCommand)
                                           .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                           .Build();
        }
        public void AddCommandByType_CommandNotNull_LocatorWasCalled()
        {
            bool wasCalled = false;

            _locator.GetCommand <IWaitableCommand>().Returns(_waitableCommand);
            _locator.When(locator => locator.GetCommand <TestWaitableCommand>()).Do(info => wasCalled = true);
            _macroCommand.AddCommand <TestWaitableCommand>();
            Assert.IsTrue(wasCalled);
        }
        public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater,
                                EditionHelper editionHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider)
            : base(translationUpdater)
        {
            _editionHelper           = editionHelper;
            _versionHelper           = versionHelper;
            _applicationNameProvider = applicationNameProvider;

            WhatsNewCommand        = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew);
            PrioritySupportCommand = commandLocator.GetCommand <IPrioritySupportUrlOpenCommand>();
        }
        public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater,
                                EditionHelper editionHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider)
            : base(translationUpdater)
        {
            _versionHelper           = versionHelper;
            _applicationNameProvider = applicationNameProvider;
            AllowPrioritySupport     = !editionHelper?.ShowOnlyForPlusAndBusiness ?? true;

            WhatsNewCommand        = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew);
            PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>();
        }
        public LoggingSettingViewModel(IInteractionInvoker invoker, IFile fileWrap,
                                       ITranslationUpdater translationUpdater, IGpoSettings gpoSettings, ICommandLocator commandLocator, ICurrentSettings <ApplicationSettings> applicationSettings)
            : base(translationUpdater, gpoSettings)
        {
            _fileWrap           = fileWrap;
            ApplicationSettings = applicationSettings;
            _quickActionOpenExplorerLocationCommand = commandLocator.GetCommand <QuickActionOpenExplorerLocationCommand>();
            _invoker = invoker;

            ShowLogFileCommand  = new DelegateCommand(ShowLogFileExecute);
            ClearLogFileCommand = new DelegateCommand(ClearLogFileExecute);
        }
Exemple #21
0
        public TitleReplacementsViewModel(ITranslationUpdater transalationUpdater, ICurrentSettingsProvider settingsProvider, ICommandLocator commandLocator, IGpoSettings gpoSettings) : base(transalationUpdater)
        {
            _settingsProvider  = settingsProvider;
            GpoSettings        = gpoSettings;
            TitleAddCommand    = commandLocator.GetCommand <TitleReplacementAddCommand>();
            TitleDeleteCommand = commandLocator.GetCommand <TitleReplacementRemoveCommand>();
            TitleEditCommand   = commandLocator.GetCommand <TitleReplacementEditCommand>();

            if (settingsProvider?.Settings != null)
            {
                TitleReplacements = settingsProvider.Settings.ApplicationSettings.TitleReplacement;
            }
            else
            {
                TitleReplacements = new ObservableCollection <TitleReplacement>();
            }

            UpdateReplacedText();

            TitleReplacements.CollectionChanged += TitleReplacementsOnCollectionChanged;
        }
Exemple #22
0
        public QuickActionViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator, IReadableFileSizeFormatter readableFileSizeHelper,
                                    ICurrentSettings <ObservableCollection <ConversionProfile> > profilesProvider, ICurrentSettingsProvider currentSettingsProvider) : base(translationUpdater)
        {
            _saveChangedSettingsCommand = commandLocator.GetCommand <ISaveChangedSettingsCommand>();

            _commandLocator          = commandLocator;
            _readableFileSizeHelper  = readableFileSizeHelper;
            _profilesProvider        = profilesProvider;
            _currentSettingsProvider = currentSettingsProvider;
            FinishCommand            = new DelegateCommand(OnFinish);
            InitList();
        }
Exemple #23
0
        public AccountsViewModel(
            ICurrentSettingsProvider currentSettingsProvider,
            ICurrentSettings <Conversion.Settings.Accounts> accountProvider,
            ICommandLocator commandLocator,
            ITranslationUpdater translationUpdater,
            IDispatcher dispatcher,
            IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _dispatcher       = dispatcher;
            _gpoSettings      = gpoSettings;
            _accountsProvider = accountProvider;
            _commandLocator   = commandLocator;
            ConflateAllAccounts();

            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;
                currentSettingsProvider.SettingsChanged        += CurrentSettingsProviderOnSettingsChanged;
            }
        }
Exemple #24
0
        public HomeViewModel(IInteractionInvoker interactionInvoker, IFileConversionAssistant fileConversionAssistant, ITranslationUpdater translationUpdater,
                             IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IJobHistoryManager jobHistoryManager, IDispatcher dispatcher,
                             ICommandLocator commandLocator)
            : base(translationUpdater)
        {
            _interactionInvoker      = interactionInvoker;
            _fileConversionAssistant = fileConversionAssistant;
            _printerHelper           = printerHelper;
            _settingsProvider        = settingsProvider;

            JobHistory = CollectionViewSource.GetDefaultView(jobHistoryManager.History);
            jobHistoryManager.HistoryChanged += (sender, args) =>
            {
                dispatcher.BeginInvoke(JobHistory.Refresh);
                RaisePropertyChanged(nameof(NumberOfHistoricJobs));
            };
            JobHistory.MoveCurrentTo(null); //unselect first item

            ConvertFileCommand = new DelegateCommand(o => ConvertFileExecute());

            ClearHistoryCommand         = new DelegateCommand(o => jobHistoryManager.Clear());
            RefreshHistoryCommand       = new DelegateCommand(o => jobHistoryManager.Refresh());
            RemoveHistoricJobCommand    = new DelegateCommand <HistoricJob>(jobHistoryManager.Remove);
            ToggleHistoryEnabledCommand = new DelegateCommand <HistoricJob>(hj => HistoryEnabled = !HistoryEnabled);

            DeleteHistoricFilesCommand = commandLocator.CreateMacroCommand()
                                         .AddCommand <DeleteHistoricFilesCommand>()
                                         .AddCommand(RefreshHistoryCommand)
                                         .Build();

            StartQuickActionCommand = new DelegateCommand(StartQuickActionCommandExecute);

            QuickActionOpenList = new List <QuickActionListItemVo>
            {
                new QuickActionListItemVo(Translation.OpenPDFArchitect, commandLocator.GetCommand <QuickActionOpenWithPdfArchitectCommand>(), StartQuickActionCommand),
                new QuickActionListItemVo(Translation.OpenDefaultProgram, commandLocator.GetCommand <QuickActionOpenWithDefaultCommand>(), StartQuickActionCommand),
                new QuickActionListItemVo(Translation.OpenExplorer, commandLocator.GetCommand <QuickActionOpenExplorerLocationCommand>(), StartQuickActionCommand),
                new QuickActionListItemVo(Translation.OpenMailClient, commandLocator.GetCommand <QuickActionOpenMailClientCommand>(), StartQuickActionCommand)
            };
        }
Exemple #25
0
        public void LoggingFileExists_ShowLogFileExecute_ProcessStarterGetsCalled()
        {
            _fileWrap.Exists(Arg.Any <string>()).Returns(true);
            var viewModel = BuildViewModel();

            viewModel.ShowLogFileCommand.Execute(null);

            Received.InOrder(() =>
            {
                _commandLocator.GetCommand <QuickActionOpenExplorerLocationCommand>();
                _fileWrap.Exists(Arg.Any <string>());
            });
        }
Exemple #26
0
        protected override void DoWorkflowWork(Job job)
        {
            job.OutputFilenameTemplate = ComposeFilename(job);

            if (job.Profile.SkipPrintDialog)
            {
                _commandLocator.GetCommand <SkipPrintDialogCommand>().Execute(job);
            }

            _logger.Debug("Starting PrintJobWindow");
            _shellManager.ShowPrintJobShell(job);
            _settingsProvider.Settings.ApplicationSettings.LastUsedProfileGuid = job.Profile.Guid;
        }
Exemple #27
0
        public AboutViewModel(IVersionHelper versionHelper
                              , ITranslationUpdater translationUpdater
                              , ICommandLocator commandLocator, ApplicationNameProvider applicationNameProvider, EditionHelper editionHelper) : base(translationUpdater)
        {
            ApplicationNameProvider = applicationNameProvider;
            VersionText             = versionHelper.FormatWithBuildNumber();

            ShowManualCommand  = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.General);
            ShowLicenseCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.License);

            PdfforgeWebsiteCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PdfforgeWebsiteUrl);
            IsLicensedVersion      = !editionHelper?.ShowOnlyForPlusAndBusiness ?? true;
            PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>();
        }
        public void SetUp()
        {
            _openFileInteractionHelper = Substitute.For <IOpenFileInteractionHelper>();
            _editionHintOptionProvider = new EditionHintOptionProvider(false, false);

            _translationFactory = new TranslationFactory();
            _translationUpdater = new TranslationUpdater(_translationFactory, new ThreadManager());

            _currentSettingsProvider = Substitute.For <ICurrentSettingsProvider>();
            _profile = new ConversionProfile();
            _currentSettingsProvider.SelectedProfile.Returns(_profile);

            var settings = new PdfCreatorSettings(null);

            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();
            settings.ApplicationSettings.Accounts.TimeServerAccounts = _timeServerAccounts;
            _currentSettingsProvider.Settings.Returns(settings);
            _currentSettingsProvider.SelectedProfile.Returns(new ConversionProfile());

            _tokenHelper   = new TokenHelper(_translationUpdater);
            _tokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;

            _commandLocator = Substitute.For <ICommandLocator>();
            _commandLocator.CreateMacroCommand().Returns(x => new MacroCommandBuilder(_commandLocator));

            _timeServerAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountAddCommand>().Returns(_timeServerAddCommand);

            _timeServerEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountEditCommand>().Returns(_timeServerEditCommand);

            _signaturePasswordCheck = Substitute.For <ISignaturePasswordCheck>();

            _file = Substitute.For <IFile>();

            InitViewModel();
        }
        public ProfilesViewModel(
            ISelectedProfileProvider selectedProfileProvider,
            ITranslationUpdater translationUpdater,
            ICommandLocator commandLocator,
            ISettingsProvider settingsProvider,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profileProvider,
            IGpoSettings gpoSettings,
            IRegionManager regionManager,
            IEventAggregator eventAggregator)
            : base(translationUpdater)
        {
            _settingsProvider = settingsProvider;
            _profileProvider  = profileProvider;
            _regionManager    = regionManager;
            _eventAggregator  = eventAggregator;

            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileAddCommand    = commandLocator.GetCommand <ProfileAddCommand>();
            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();
            _switchLayoutCommand = commandLocator.GetCommand <SwitchLayoutCommand>() as IAsyncCommand;
        }
        private void OnEditSelectedCommand(object obj)
        {
            switch (SelectedAccount)
            {
            case HttpAccount httpAccount:
                _commandLocator.GetCommand <HttpAccountEditCommand>().Execute(httpAccount);
                break;

            case SmtpAccount smtpAccount:
                _commandLocator.GetCommand <SmtpAccountEditCommand>().Execute(smtpAccount);
                break;

            case FtpAccount ftpAccount:
                _commandLocator.GetCommand <FtpAccountEditCommand>().Execute(ftpAccount);
                break;

            case TimeServerAccount timeServerAccount:
                _commandLocator.GetCommand <TimeServerAccountEditCommand>().Execute(timeServerAccount);
                break;
            }
        }