Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public SmtpActionViewModel(IInteractionRequest interactionRequest, ISmtpTest smtpTest, ITranslationUpdater updater, ICurrentSettingsProvider currentSettingsProvider,
                                   ICommandLocator commandLocator, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher) : base(updater, currentSettingsProvider, dispatcher)
        {
            _interactionRequest      = interactionRequest;
            _smtpTest                = smtpTest;
            _currentSettingsProvider = currentSettingsProvider;

            SetTokenViewModel(tokenViewModelFactory);

            if (currentSettingsProvider?.Settings != null)
            {
                _smtpAccounts    = currentSettingsProvider.Settings.ApplicationSettings.Accounts.SmtpAccounts;
                SmtpAccountsView = new ListCollectionView(_smtpAccounts);
                SmtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(SmtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

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

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <SmtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();

            EditMailTextCommand = new DelegateCommand(EditMailTextExecute);
            TestSmtpCommand     = new DelegateCommand(TextSmtpExecute);
        }
Exemplo n.º 3
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.º 4
0
        public ScriptUserControlViewModel(
            ITranslationUpdater translationUpdater,
            ISelectedProfileProvider provider,
            IOpenFileInteractionHelper openFileInteractionHelper,
            IScriptActionHelper scriptActionHelper,
            ITokenHelper tokenHelper,
            ITokenViewModelFactory tokenViewModelFactory,
            IDispatcher dispatcher)
            : base(translationUpdater, provider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _scriptActionHelper        = scriptActionHelper;
            _tokenHelper           = tokenHelper;
            _tokenViewModelFactory = tokenViewModelFactory;

            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();
            }
        }
Exemplo n.º 5
0
 public FtpAccountViewModel(ITranslationUpdater translationUpdater, IOpenFileInteractionHelper openFileInteractionHelper,
                            ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory) : base(translationUpdater)
 {
     _openFileInteractionHelper = openFileInteractionHelper;
     _tokenHelper           = tokenHelper;
     _tokenViewModelFactory = tokenViewModelFactory;
 }
Exemplo n.º 6
0
        public MetadataViewModel(ITranslationUpdater translationUpdater, TokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory) : base(translationUpdater)
        {
            _tokenHelper           = tokenHelper;
            _tokenViewModelFactory = tokenViewModelFactory;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels(tokenViewModelFactory));
        }
Exemplo n.º 7
0
 private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory)
 {
     SharedFolderTokenViewModel = tokenViewModelFactory
                                  .BuilderWithSelectedProfile()
                                  .WithSelector(p => p.DropboxSettings.SharedFolder)
                                  .WithDefaultTokenReplacerPreview(th => th.GetTokenListForDirectory())
                                  .Build();
 }
Exemplo n.º 8
0
        public MetadataViewModel(ITranslationUpdater translationUpdater, ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory,
                                 ISelectedProfileProvider selectedProfileProvider, IDispatcher dispatcher) : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            _tokenHelper           = tokenHelper;
            _tokenViewModelFactory = tokenViewModelFactory;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels(tokenViewModelFactory));
        }
        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();
        }
 private void SetTokenViewModels(ITokenViewModelFactory tokenViewModelFactory, List <string> tokens)
 {
     StampUserControlTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Stamping.StampText)
                                      .WithTokenList(tokens)
                                      .WithTokenCustomPreview(TokenReplace)
                                      .Build();
 }
Exemplo n.º 11
0
 public WatermarkViewModel(IOpenFileInteractionHelper openFileInteractionHelper, ITranslationUpdater translationUpdater,
                           ISelectedProfileProvider selectedProfile, ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory,
                           IDispatcher dispatcher, IPdfVersionHelper pdfVersionHelper)
     : base(translationUpdater, selectedProfile, dispatcher)
 {
     _openFileInteractionHelper = openFileInteractionHelper;
     _tokenHelper           = tokenHelper;
     _tokenViewModelFactory = tokenViewModelFactory;
     _pdfVersionHelper      = pdfVersionHelper;
 }
Exemplo n.º 12
0
        public SaveTabViewModel(TokenButtonFunctionProvider buttonFunctionProvider, ISelectedProfileProvider selectedProfileProvider,
                                ITranslationUpdater translationUpdater, EditionHintOptionProvider editionHintOptionProvider, TokenHelper tokenHelper,
                                ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            AllowSkipPrintDialog    = !editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
            _buttonFunctionProvider = buttonFunctionProvider;
            _tokenHelper            = tokenHelper;
            _tokenViewModelFactory  = tokenViewModelFactory;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels());
        }
Exemplo n.º 13
0
 public AttachmentUserControlViewModel(IOpenFileInteractionHelper openFileInteractionHelper, ITranslationUpdater translationUpdater,
                                       ISelectedProfileProvider selectedProfile,
                                       ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory,
                                       IDispatcher dispatcher, EditionHelper editionHelper, IPdfVersionHelper pdfVersionHelper)
     : base(translationUpdater, selectedProfile, dispatcher)
 {
     _openFileInteractionHelper = openFileInteractionHelper;
     _tokenHelper           = tokenHelper;
     _tokenViewModelFactory = tokenViewModelFactory;
     _editionHelper         = editionHelper;
     _pdfVersionHelper      = pdfVersionHelper;
 }
Exemplo n.º 14
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.º 15
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));
        }
 public StampUserControlViewModel(IInteractionInvoker interactionInvoker, IFontHelper fontHelper, ITokenHelper tokenHelper,
                                  ITranslationUpdater translationUpdater, ISelectedProfileProvider profile, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
     : base(translationUpdater, profile, dispatcher)
 {
     _interactionInvoker    = interactionInvoker;
     _fontHelper            = fontHelper;
     _tokenHelper           = tokenHelper;
     _translationUpdater    = translationUpdater;
     _tokenViewModelFactory = tokenViewModelFactory;
     _translationUpdater.RegisterAndSetTranslation(tf =>
     {
         _tokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;
         var tokens     = _tokenHelper.GetTokenListForStamp();
         SetTokenViewModels(_tokenViewModelFactory, tokens);
     });
 }
Exemplo n.º 17
0
        public SmtpActionViewModel(IInteractionRequest interactionRequest,
                                   ISmtpTest smtpTest,
                                   ITranslationUpdater updater,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICommandLocator commandLocator,
                                   ITokenViewModelFactory tokenViewModelFactory,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings,
                                   ISelectFilesUserControlViewModelFactory selectFilesUserControlViewModelFactory)
            : base(updater, currentSettingsProvider, dispatcher)
        {
            _interactionRequest = interactionRequest;
            _smtpTest           = smtpTest;
            _accountsProvider   = accountsProvider;
            _commandLocator     = commandLocator;
            _gpoSettings        = gpoSettings;

            _smtpAccounts = _accountsProvider?.Settings.SmtpAccounts;

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

            SetTokenViewModel(tokenViewModelFactory);

            AdditionalAttachmentsViewModel = selectFilesUserControlViewModelFactory.Builder()
                                             .WithTitleGetter(() => Translation.MailAttachmentTitle)
                                             .WithFileListGetter(profile => profile.EmailSmtpSettings.AdditionalAttachments)
                                             .Build();

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

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

            EditMailTextCommand = new DelegateCommand(EditMailTextExecute);
            TestSmtpCommand     = new AsyncCommand(TestSmtpExecute);
        }
Exemplo n.º 18
0
        public SaveTabViewModel(ITokenButtonFunctionProvider buttonFunctionProvider, ISelectedProfileProvider selectedProfileProvider,
                                ITranslationUpdater translationUpdater, EditionHelper editionHelper, ITokenHelper tokenHelper,
                                ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            AllowSkipPrintDialog    = !editionHelper.IsFreeEdition;
            _buttonFunctionProvider = buttonFunctionProvider;
            _tokenHelper            = tokenHelper;
            _tokenViewModelFactory  = tokenViewModelFactory;

            translationUpdater?.RegisterAndSetTranslation(tf => SetTokenViewModels());

            CurrentProfile?.MountRaiseConditionsForNotSupportedFeatureSections((s, a) =>
            {
                RaisePropertyChanged(nameof(HasNotSupportedSettingsForSavingTempOnly));
            });
        }
Exemplo n.º 19
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();
        }
        public MailClientControlViewModel(IInteractionRequest interactionRequest,
                                          IClientTestEmail clientTestEmail,
                                          ITranslationUpdater translationUpdater,
                                          ISelectedProfileProvider selectedProfileProvider,
                                          ITokenViewModelFactory tokenViewModelFactory,
                                          IDispatcher dispatcher,
                                          IOpenFileInteractionHelper openFileInteractionHelper)
            : base(translationUpdater, selectedProfileProvider, dispatcher, openFileInteractionHelper)
        {
            _interactionRequest = interactionRequest;
            _clientTestEmail    = clientTestEmail;

            CreateTokenViewModels(tokenViewModelFactory);

            EmailClientTestCommand        = new DelegateCommand(EmailClientTestExecute);
            EditEmailTextCommand          = new DelegateCommand(EditEmailTextExecute);
            RemoveSelectedFromListCommand = new DelegateCommand(RemoveSelectedFromList);
        }
Exemplo n.º 21
0
        public SignUserControlViewModel(
            IOpenFileInteractionHelper openFileInteractionHelper, EditionHintOptionProvider editionHintOptionProvider,
            ITranslationUpdater translationUpdater, ICurrentSettingsProvider currentSettingsProvider,
            ICommandLocator commandLocator, ISignaturePasswordCheck signaturePasswordCheck,
            IFile file, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;

            _signaturePasswordCheck = signaturePasswordCheck;
            _file = file;

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

            if (editionHintOptionProvider != null)
            {
                OnlyForPlusAndBusiness = editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
            }

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

            ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute);

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

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

            EditTimeServerAccountCommand = commandLocator.CreateMacroCommand()
                                           .AddCommand <TimeServerAccountEditCommand>()
                                           .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                           .Build();
        }
Exemplo n.º 22
0
        public DropboxUserControlViewModel(ITranslationUpdater translationUpdater,
                                           ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                           ICurrentSettingsProvider currentSettingsProvider,
                                           ICommandLocator commandLocator,
                                           ITokenViewModelFactory tokenViewModelFactory,
                                           IDispatcher dispatcher,
                                           IGpoSettings gpoSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _gpoSettings             = gpoSettings;
            AddDropboxAccountCommand = commandLocator.CreateMacroCommand()
                                       .AddCommand <DropboxAccountAddCommand>()
                                       .AddCommand(new DelegateCommand(SelectNewAccountInView))
                                       .Build();

            DropboxAccounts = accountsProvider?.Settings.DropboxAccounts;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels(tokenViewModelFactory));
        }
Exemplo n.º 23
0
        public SignatureUserControlViewModel(
            IOpenFileInteractionHelper openFileInteractionHelper,
            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,
            IHashUtil hashUtil, IInteractionRequest interactionRequest)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _accountsProvider          = accountsProvider;
            _translationUpdater        = translationUpdater;
            _currentSettingsProvider   = currentSettingsProvider;

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

            _signingPositionToUnitConverter = signingPositionToUnitConverter;
            _hashUtil           = hashUtil;
            _interactionRequest = interactionRequest;
            ApplicationSettings = applicationSettings;
            UnitConverter       = _signingPositionToUnitConverter?.CreateSigningPositionToUnitConverter(UnitOfMeasurement.Centimeter);

            ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute);
            ChangeUnitConverterCommand   = new DelegateCommand(ChangeUnitConverterExecute);

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

            EditTimeServerAccountCommand = commandLocator.CreateMacroCommand()
                                           .AddCommand <TimeServerAccountEditCommand>()
                                           .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                           .Build();

            SignaturePasswordCommand = new DelegateCommand(ShowPasswordEntryInteraction);
        }
Exemplo n.º 24
0
        public WorkflowEditorViewModel(ISelectedProfileProvider selectedProfileProvider,
                                       ITranslationUpdater translationUpdater, MetadataViewModel metadataViewModel,
                                       IEnumerable <IActionFacade> actionFacades, IInteractionRequest interactionRequest,
                                       ITokenViewModelFactory tokenViewModelFactory,
                                       IEventAggregator eventAggregator, ICommandLocator commandLocator) : base(translationUpdater)
        {
            _selectedProfileProvider = selectedProfileProvider;
            _translationUpdater      = translationUpdater;
            _interactionRequest      = interactionRequest;
            _tokenViewModelFactory   = tokenViewModelFactory;
            _eventAggregator         = eventAggregator;
            _commandLocator          = commandLocator;

            ActionFacades      = actionFacades;
            _metadataViewModel = metadataViewModel;

            RemoveActionCommand          = new DelegateCommand(ExecuteRemoveAction);
            EditActionCommand            = new DelegateCommand(ExecuteEditAction);
            OpenAddActionOverviewCommand = new DelegateCommand(OpenAddActionOverview);

            SetMetaDataCommand     = new DelegateCommand(async _ => await OpenEditDialog(ViewProvider.MetaDataOverlay, Translation.MetadataTab));
            SetSaveCommand         = new DelegateCommand(async _ => await OpenEditDialog(ViewProvider.SaveOverlay, Translation.Save));
            SetOutputFormatCommand = new DelegateCommand(async _ => await OpenEditDialog(ViewProvider.OutputFormatOverlay, Translation.OutputFormat));
            SetPrinterCommand      = new DelegateCommand(async _ => await OpenEditDialog((ViewProvider as ServerWorkflowEditorSubViewProvider)?.PrinterOverlay, Translation.OutputFormat));

            PreparationDropTarget   = new WorkflowEditorActionDropTargetHandler <IPreConversionAction>();
            ModifyDropTarget        = new WorkflowEditorActionDropTargetHandler <IConversionAction>();
            ModifyDragSourceHandler = new WorkflowEditorActionDragSourceHandler(obj =>
            {
                var facade           = (IActionFacade)obj;
                var isAssignableFrom = typeof(IFixedOrderAction).IsAssignableFrom(facade.SettingsType);
                return(!isAssignableFrom);
            });
            SendDropTarget = new WorkflowEditorActionDropTargetHandler <IPostConversionAction>();

            _translationUpdater.RegisterAndSetTranslation(tf => _metadataViewModel.SetTokenViewModels(tokenViewModelFactory));

            if (_selectedProfileProvider != null)
            {
                _selectedProfileProvider.SelectedProfileChanged += SelectedProfileOnPropertyChanged;
            }
        }
Exemplo n.º 25
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.º 26
0
        public SmtpActionViewModel(IInteractionRequest interactionRequest,
                                   ISmtpTest smtpTest,
                                   ITranslationUpdater updater,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICommandLocator commandLocator,
                                   ITokenViewModelFactory tokenViewModelFactory,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings,
                                   IOpenFileInteractionHelper openFileInteractionHelper)
            : base(updater, currentSettingsProvider, dispatcher, openFileInteractionHelper)
        {
            _interactionRequest = interactionRequest;
            _smtpTest           = smtpTest;
            _accountsProvider   = accountsProvider;
            _commandLocator     = commandLocator;
            _gpoSettings        = gpoSettings;

            _smtpAccounts = _accountsProvider?.Settings.SmtpAccounts;

            if (_smtpAccounts != null)
            {
                SmtpAccountsView = new ListCollectionView(_smtpAccounts);
                SmtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(SmtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            SetTokenViewModel(tokenViewModelFactory);

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

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

            EditMailTextCommand = new DelegateCommand(EditMailTextExecute);
            TestSmtpCommand     = new AsyncCommand(TestSmtpExecute);
        }
Exemplo n.º 27
0
        public MailClientControlViewModel(IInteractionRequest interactionRequest,
                                          IClientTestMailAssistant clientTestMailAssistant,
                                          ITranslationUpdater translationUpdater,
                                          ISelectedProfileProvider selectedProfileProvider,
                                          ITokenViewModelFactory tokenViewModelFactory,
                                          IDispatcher dispatcher,
                                          ISelectFilesUserControlViewModelFactory selectFilesUserControlViewModelFactory)
            : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            _interactionRequest      = interactionRequest;
            _clientTestMailAssistant = clientTestMailAssistant;

            CreateTokenViewModels(tokenViewModelFactory);

            EmailClientTestCommand = new AsyncCommand(EmailClientTestExecute);
            EditEmailTextCommand   = new DelegateCommand(EditEmailTextExecute);

            AdditionalAttachmentsViewModel = selectFilesUserControlViewModelFactory.Builder()
                                             .WithTitleGetter(() => Translation.MailAttachmentTitle)
                                             .WithFileListGetter(profile => profile.EmailClientSettings.AdditionalAttachments)
                                             .Build();
        }
Exemplo n.º 28
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.º 29
0
        public SelectFileViewModel(ITranslationUpdater translationUpdater,
                                   ITokenViewModelFactory tokenViewModelFactory,
                                   IOpenFileInteractionHelper openFileInteractionHelper)
            : base(translationUpdater)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _tokenViewModelFactory     = tokenViewModelFactory;
            var builder = tokenViewModelFactory
                          .Builder <SelectFileInteraction>()
                          .WithDefaultTokenReplacerPreview(th => th.GetTokenListForFilename()); // Tokens are overriden in HandleInteractionObjectChanged if Interaction.Tokens is set

            AdditionalAttachmentsTokenViewModel = builder
                                                  .WithSelector(interaction => interaction.File)
                                                  .WithButtonCommand(SelectFileAction)
                                                  .Build();

            AddEditCommand = new DelegateCommand(ApplyExecute, o => !string.IsNullOrWhiteSpace(AdditionalAttachmentsTokenViewModel.Text));
            AdditionalAttachmentsTokenViewModel.TextChanged += (sender, args) => AddEditCommand.RaiseCanExecuteChanged();

            RemoveCommand = new DelegateCommand(RemoveExecute);
            CancelCommand = new DelegateCommand(CancelExecute);
        }
        public AttachmentUserControlViewModel(IOpenFileInteractionHelper openFileInteractionHelper, ITranslationUpdater translationUpdater,
                                              ISelectedProfileProvider selectedProfile,
                                              ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, selectedProfile, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;

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

                AttachmentFileTokenViewModel = tokenViewModelFactory.BuilderWithSelectedProfile()
                                               .WithSelector(p => p.AttachmentPage.File)
                                               .WithTokenList(tokens)
                                               .WithTokenReplacerPreview(TokenReplacer)
                                               .WithButtonCommand(SelectAttatchmentAction)
                                               .Build();

                RaisePropertyChanged(nameof(AttachmentFileTokenViewModel));
            }
        }