Exemple #1
0
 public AttachmentUserControlViewModel(ITranslationUpdater translationUpdater,
                                       ISelectedProfileProvider selectedProfile, ITokenHelper tokenHelper,
                                       IDispatcher dispatcher, IPdfVersionHelper pdfVersionHelper,
                                       ISelectFilesUserControlViewModelFactory selectFilesUserControlViewModelFactory)
     : base(translationUpdater, selectedProfile, dispatcher)
 {
     _tokenHelper      = tokenHelper;
     _pdfVersionHelper = pdfVersionHelper;
     _selectFilesUserControlViewModelFactory = selectFilesUserControlViewModelFactory;
 }
        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);
        }
Exemple #3
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();
        }