Exemplo n.º 1
0
        public ScriptUserControlViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider provider, IOpenFileInteractionHelper openFileInteractionHelper, IScriptActionHelper scriptActionHelper, TokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, provider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _scriptActionHelper        = scriptActionHelper;

            if (tokenHelper != null)
            {
                TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders;
                var tokens = tokenHelper.GetTokenListWithFormatting();

                ParameterTokenViewModel = tokenViewModelFactory.BuilderWithSelectedProfile()
                                          .WithSelector(p => p.Scripting.ParameterString)
                                          .WithTokenList(tokens)
                                          .WithTokenReplacerPreview(TokenReplacer)
                                          .Build();

                ScriptFileTokenViewModel = tokenViewModelFactory.BuilderWithSelectedProfile()
                                           .WithSelector(p => p.Scripting.ScriptFile)
                                           .WithTokenList(tokens)
                                           .WithTokenReplacerPreview(TokenReplacer)
                                           .WithButtonCommand(SelectScriptFileAction)
                                           .Build();

                ParameterTokenViewModel.TextChanged  += TokenTextChanged;
                ScriptFileTokenViewModel.TextChanged += TokenTextChanged;
                TokenTextChanged(this, EventArgs.Empty);
            }
        }
Exemplo n.º 2
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();
            });
        }
Exemplo n.º 3
0
        public FtpActionViewModel(TokenHelper tokenHelper, ITranslationUpdater translationUpdater, ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            // TODO update on translation change!
            DirectoryTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();

            if (currentSettingsProvider?.Settings != null)
            {
                _ftpAccounts    = currentSettingsProvider.Settings.ApplicationSettings.Accounts.FtpAccounts;
                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();
        }
Exemplo n.º 4
0
 private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
 {
     SharedFolderTokenViewModel = tokenViewModelFactory
                                  .BuilderWithSelectedProfile()
                                  .WithSelector(p => p.DropboxSettings.SharedFolder)
                                  .WithDefaultTokenReplacerPreview(th => th.GetTokenListForDirectory())
                                  .Build();
 }
 private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory, List <string> tokens)
 {
     StampUserControlTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Stamping.StampText)
                                      .WithTokenList(tokens)
                                      .WithTokenCustomPreview(TokenReplace)
                                      .Build();
 }
Exemplo n.º 6
0
        public void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory
                          .BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForMetadata());

            TitleTokenViewModel    = builder.WithSelector(p => p.TitleTemplate).Build();
            AuthorTokenViewModel   = builder.WithSelector(p => p.AuthorTemplate).Build();
            SubjectTokenViewModel  = builder.WithSelector(p => p.SubjectTemplate).Build();
            KeywordsTokenViewModel = builder.WithSelector(p => p.KeywordTemplate).Build();

            UpdateMetadata();
        }
Exemplo n.º 7
0
        private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory
                          .BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForMetadata());

            TitleTokenViewModel    = builder.WithSelector(p => p.TitleTemplate).Build();
            AuthorTokenViewModel   = builder.WithSelector(p => p.AuthorTemplate).Build();
            SubjectTokenViewModel  = builder.WithSelector(p => p.SubjectTemplate).Build();
            KeywordsTokenViewModel = builder.WithSelector(p => p.KeywordTemplate).Build();

            RaisePropertyChanged(nameof(TitleTokenViewModel));
            RaisePropertyChanged(nameof(AuthorTokenViewModel));
            RaisePropertyChanged(nameof(SubjectTokenViewModel));
            RaisePropertyChanged(nameof(KeywordsTokenViewModel));
        }
Exemplo n.º 8
0
        private void SetTokenViewModel(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory.BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForEmailRecipients());

            RecipientsTokenViewModel = builder
                                       .WithSelector(p => p.EmailSmtpSettings.Recipients)
                                       .Build();

            RecipientsCcTokenViewModel = builder
                                         .WithSelector(p => p.EmailSmtpSettings.RecipientsCc)
                                         .Build();

            RecipientsBccTokenViewModel = builder
                                          .WithSelector(p => p.EmailSmtpSettings.RecipientsBcc)
                                          .Build();
        }
Exemplo n.º 9
0
        public CoverUserControlViewModel(IOpenFileInteractionHelper openFileInteractionHelper, ITranslationUpdater translationUpdater,
                                         ISelectedProfileProvider selectedProfile, TokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher) : base(translationUpdater, selectedProfile, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;

            if (tokenHelper != null)
            {
                TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders;
                var tokens = tokenHelper.GetTokenListForExternalFiles();

                CoverPageTokenViewModel = tokenViewModelFactory.BuilderWithSelectedProfile()
                                          .WithSelector(p => p.CoverPage.File)
                                          .WithTokenList(tokens)
                                          .WithTokenReplacerPreview(TokenReplacer)
                                          .WithButtonCommand(SelectCoverPageAction)
                                          .Build();

                RaisePropertyChanged(nameof(CoverPageTokenViewModel));
            }
        }
Exemplo n.º 10
0
        public override void MountView()
        {
            if (_tokenHelper != null)
            {
                TokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;
                var tokens = _tokenHelper.GetTokenListForExternalFiles();
                WatermarkTokenViewModel = _tokenViewModelFactory.BuilderWithSelectedProfile()
                                          .WithSelector(p => p.Watermark.File)
                                          .WithTokenList(tokens)
                                          .WithTokenReplacerPreview(TokenReplacer)
                                          .WithButtonCommand(SelectWatermarkFileAction)
                                          .Build();
                RaisePropertyChanged(nameof(WatermarkTokenViewModel));
                WatermarkTokenViewModel.MountView();
            }

            CheckIfVersionIsPdf20();

            base.MountView();
        }
Exemplo n.º 11
0
        private void CreateTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory
                          .BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForEmailRecipients());

            RecipientsTokenViewModel = builder
                                       .WithSelector(p => p.EmailClientSettings.Recipients)
                                       .Build();

            RecipientsCcTokenViewModel = builder
                                         .WithSelector(p => p.EmailClientSettings.RecipientsCc)
                                         .Build();

            RecipientsBccTokenViewModel = builder
                                          .WithSelector(p => p.EmailClientSettings.RecipientsBcc)
                                          .Build();

            RaisePropertyChanged(nameof(RecipientsTokenViewModel));
        }
Exemplo n.º 12
0
        public FtpActionViewModel(ITranslationUpdater translationUpdater,
                                  ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                  ICurrentSettingsProvider currentSettingsProvider,
                                  ICommandLocator commandLocator,
                                  ITokenViewModelFactory tokenViewModelFactory,
                                  IDispatcher dispatcher,
                                  IGpoSettings gpoSettings)

            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _accountsProvider      = accountsProvider;
            _commandLocator        = commandLocator;
            _tokenViewModelFactory = tokenViewModelFactory;
            _gpoSettings           = gpoSettings;

            _ftpAccounts = _accountsProvider?.Settings.FtpAccounts;

            if (_ftpAccounts != null)
            {
                FtpAccountsView = new ListCollectionView(_ftpAccounts);
                FtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(FtpAccount.AccountInfo), ListSortDirection.Ascending));
                FtpAccountsView.CurrentChanged += (sender, args) => RaisePropertyChanged(nameof(ShowAutosaveRequiresPasswords));
            }

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

            EditAccountCommand = _commandLocator.CreateMacroCommand()
                                 .AddCommand <FtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();

            DirectoryTokenViewModel = _tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();
        }
Exemplo n.º 13
0
        private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory
                          .BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting());

            SignReasonTokenViewModel = builder
                                       .WithSelector(p => p.PdfSettings.Signature.SignReason)
                                       .Build();

            SignContactTokenViewModel = builder
                                        .WithSelector(p => p.PdfSettings.Signature.SignContact)
                                        .Build();

            SignLocationTokenViewModel = builder
                                         .WithSelector(p => p.PdfSettings.Signature.SignLocation)
                                         .Build();

            RaisePropertyChanged(nameof(SignReasonTokenViewModel));
            RaisePropertyChanged(nameof(SignContactTokenViewModel));
            RaisePropertyChanged(nameof(SignLocationTokenViewModel));
        }
Exemplo n.º 14
0
        private void SetTokenViewModels()
        {
            _tokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;
            var builder = _tokenViewModelFactory
                          .BuilderWithSelectedProfile();

            FileNameViewModel = builder
                                .WithTokenList(_tokenHelper.GetTokenListForFilename())
                                .WithTokenCustomPreview(PreviewForFileName)
                                .WithSelector(p => p.FileNameTemplate)
                                .Build();

            FolderViewModel = builder
                              .WithTokenList(_tokenHelper.GetTokenListForDirectory())
                              .WithTokenCustomPreview(PreviewForFolder)
                              .WithSelector(p => p.TargetDirectory)
                              .WithButtonCommand(_buttonFunctionProvider.GetBrowseFolderFunction(Translation.ChooseFolder))
                              .Build();

            RaisePropertyChanged(nameof(FileNameViewModel));
            RaisePropertyChanged(nameof(FolderViewModel));
        }
Exemplo n.º 15
0
        private void SetTokenViewModel(ITokenViewModelFactory tokenViewModelFactory)
        {
            var builder = tokenViewModelFactory.BuilderWithSelectedProfile()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForEmailRecipients());

            RecipientsTokenViewModel = builder
                                       .WithSelector(p => p.EmailSmtpSettings.Recipients)
                                       .Build();

            RecipientsCcTokenViewModel = builder
                                         .WithSelector(p => p.EmailSmtpSettings.RecipientsCc)
                                         .Build();

            RecipientsBccTokenViewModel = builder
                                          .WithSelector(p => p.EmailSmtpSettings.RecipientsBcc)
                                          .Build();

            AdditionalAttachmentsTokenViewModel = builder
                                                  .WithSelector(p => AdditionalAttachmentsForTextBox)
                                                  .WithButtonCommand(SelectAttachmentFileAction)
                                                  .WithSecondaryButtonCommand(AddFilePathToAdditionalAttachments)
                                                  .Build();
        }