Пример #1
0
        public override void MountView()
        {
            if (_tokenHelper != null)
            {
                TokenReplacer = _tokenHelper.TokenReplacerWithPlaceHolders;
                var tokens = _tokenHelper.GetTokenListForExternalFiles();
                var filter = Translation.PDFFiles
                             + @" (*.pdf)|*.pdf|"
                             + Translation.AllFiles
                             + @" (*.*)|*.*";

                AttachmentFileSelectFilesUserControlViewModel = _selectFilesUserControlViewModelFactory.Builder()
                                                                .WithTitleGetter(() => Translation.SelectAttachmentFile)
                                                                .WithFileListGetter(profile => profile.AttachmentPage.Files)
                                                                .WithFileFilter(filter)
                                                                .WithTokens(tokens)
                                                                .Build();
                AttachmentFileSelectFilesUserControlViewModel.PropertyChanged += (s, a) =>
                {
                    if (a.PropertyName == nameof(AttachmentFileSelectFilesUserControlViewModel.FileListDictionary))
                    {
                        CheckIfVersionIsPdf20();
                    }
                };

                RaisePropertyChanged(nameof(AttachmentFileSelectFilesUserControlViewModel));
                AttachmentFileSelectFilesUserControlViewModel.MountView();
            }

            CheckIfVersionIsPdf20();

            base.MountView();
        }
Пример #2
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);
        }
Пример #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();
        }