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 FtpAccountViewModel(ITranslationUpdater translationUpdater, IOpenFileInteractionHelper openFileInteractionHelper,
                            ITokenHelper tokenHelper, ITokenViewModelFactory tokenViewModelFactory) : base(translationUpdater)
 {
     _openFileInteractionHelper = openFileInteractionHelper;
     _tokenHelper           = tokenHelper;
     _tokenViewModelFactory = tokenViewModelFactory;
 }
        public SignUserControlViewModel(IInteractionRequest interactionRequest, IFile file,
                                        IOpenFileInteractionHelper openFileInteractionHelper, EditionHintOptionProvider editionHintOptionProvider,
                                        ITranslationUpdater translationUpdater, ISelectedProfileProvider selectedProfile,
                                        ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator)
            : base(translationUpdater, selectedProfile)
        {
            _file = file;
            _openFileInteractionHelper = openFileInteractionHelper;
            _interactionRequest        = interactionRequest;
            _currentSettingsProvider   = currentSettingsProvider;

            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);
            SignaturePasswordCommand     = new DelegateCommand(SignaturePasswordExecute);

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

            EditTimeServerAccountCommand = commandLocator.GetMacroCommand()
                                           .AddCommand <TimeServerAccountEditCommand>()
                                           .AddCommand(new DelegateCommand(o => RefreshAccountsView()));
        }
        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 AttatchmentActionViewModel(IOpenFileInteractionHelper openFileInteractionHelper, AttachmentSettingsAndActionTranslation translations)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            Translation = translations;

            DisplayName             = Translation.DisplayName;
            Description             = Translation.Description;
            SelectAttatchmenCommand = new DelegateCommand(SelectAttatchmentExecute);
        }
        public AttatchmentActionViewModel(ITranslator translator, IOpenFileInteractionHelper openFileInteractionHelper)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            Translator = translator;

            DisplayName             = Translator.GetTranslation("AttachmentSettings", "DisplayName");
            Description             = Translator.GetTranslation("AttachmentSettings", "Description");
            SelectAttatchmenCommand = new DelegateCommand(SelectAttatchmentExecute);
        }
Exemplo n.º 7
0
        public BackgroundActionViewModel(BackgroundSettingsAndActionTranslation translation, IOpenFileInteractionHelper openFileInteractionHelper)
        {
            Translation = translation;
            _openFileInteractionHelper = openFileInteractionHelper;

            SelectBackgroundCommand = new DelegateCommand(SelectBackgroundExecute);
            DisplayName             = Translation.DisplayName;
            Description             = Translation.Description;
        }
Exemplo n.º 8
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.º 9
0
        public CoverActionViewModel(CoverSettingsTranslation translation, IOpenFileInteractionHelper openFileInteractionHelper)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            Translation = translation;

            SelectCoverCommand = new DelegateCommand(SelectCoverExecute);

            DisplayName = Translation.DisplayName;
            Description = Translation.Description;
        }
        public BackgroundActionViewModel(ITranslator translator, IOpenFileInteractionHelper openFileInteractionHelper)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            Translator = translator;

            SelectBackgroundCommand = new DelegateCommand(SelectBackgroundExecute);

            DisplayName = translator.GetTranslation("BackgroundSettings", "DisplayName");
            Description = translator.GetTranslation("BackgroundSettings", "Description");
        }
        public CoverActionViewModel(ITranslator translator, IOpenFileInteractionHelper openFileInteractionHelper)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            Translator = translator;

            SelectCoverCommand = new DelegateCommand(SelectCoverExecute);

            DisplayName = Translator.GetTranslation("CoverSettings", "DisplayName");
            Description = Translator.GetTranslation("CoverSettings", "Description");
        }
Exemplo n.º 12
0
 public PdfTabViewModel(ITranslator translator, IInteractionInvoker interactionInvoker, IFile file, IOpenFileInteractionHelper openFileInteractionHelper)
 {
     _file = file;
     _openFileInteractionHelper = openFileInteractionHelper;
     Translator                   = translator;
     _interactionInvoker          = interactionInvoker;
     SecurityPasswordCommand      = new DelegateCommand(SecurityPasswordExecute);
     ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute);
     DefaultTimeServerCommand     = new DelegateCommand(DefaultTimeServerExecute);
 }
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
        protected MailBaseControlViewModel(
            ITranslationUpdater translationUpdater,
            ISelectedProfileProvider selectedProfileProvider,
            IDispatcher dispatcher,
            IOpenFileInteractionHelper openFileInteractionHelper
            )
            : base(translationUpdater, selectedProfileProvider, dispatcher)
        {
            _openFileInteractionHelper = openFileInteractionHelper;

            RemoveSelectedFromListCommand = new DelegateCommand(RemoveSelectedFromList);
        }
Exemplo n.º 15
0
 public PdfTabViewModel(PdfTabTranslation translation, IInteractionInvoker interactionInvoker, IFile file,
                        IOpenFileInteractionHelper openFileInteractionHelper, EditionHintOptionProvider editionHintOptionProvider,
                        IPdfProcessor pdfProcessor, IUserGuideHelper userGuideHelper)
 {
     _file = file;
     _openFileInteractionHelper = openFileInteractionHelper;
     _pdfProcessor                = pdfProcessor;
     Translation                  = translation;
     _interactionInvoker          = interactionInvoker;
     _userGuideHelper             = userGuideHelper;
     OnlyForPlusAndBusiness       = editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
     SecurityPasswordCommand      = new DelegateCommand(SecurityPasswordExecute);
     ChooseCertificateFileCommand = new DelegateCommand(ChooseCertificateFileExecute);
     DefaultTimeServerCommand     = new DelegateCommand(DefaultTimeServerExecute);
 }
Exemplo n.º 16
0
        public DefaultViewerViewModel(ITranslationUpdater transalationUpdater, ICurrentSettingsProvider currentSettingsProvider,
                                      IGpoSettings gpoSettings, IOpenFileInteractionHelper fileInteractionHelper)
            : base(transalationUpdater)
        {
            _currentSettingsProvider = currentSettingsProvider;
            _fileInteractionHelper   = fileInteractionHelper;
            GpoSettings = gpoSettings;

            if (_currentSettingsProvider.Settings != null)
            {
                UpdateDefaultViewer();
            }

            _currentSettingsProvider.SettingsChanged += (sender, args) => UpdateDefaultViewer();
            FindPathCommand = new DelegateCommand(ExecuteFindPath);
        }
Exemplo n.º 17
0
        public ScriptActionViewModel(ScriptActionSettingsAndActionTranslation translation, IOpenFileInteractionHelper openFileInteractionHelper, IScriptActionHelper scriptActionHelper, TokenHelper tokenHelper)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _scriptActionHelper        = scriptActionHelper;
            Translation = translation;

            TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders;

            DisplayName = Translation.DisplayName;
            Description = Translation.Description;

            var tokens = new List <string>(TokenReplacer.GetTokenNames(true));

            ParameterTokenViewModel  = new TokenViewModel(x => CurrentProfile.Scripting.ParameterString = x, () => CurrentProfile?.Scripting.ParameterString, tokens);
            ScriptFileTokenViewModel = new TokenViewModel(x => CurrentProfile.Scripting.ScriptFile = x, () => CurrentProfile?.Scripting.ScriptFile, tokens);
            ParameterTokenViewModel.OnTextChanged  += TokenTextChanged;
            ScriptFileTokenViewModel.OnTextChanged += TokenTextChanged;
        }
        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);
        }
        public ScriptUserControlViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider provider, IOpenFileInteractionHelper openFileInteractionHelper, IScriptActionHelper scriptActionHelper, TokenHelper tokenHelper)
            : base(translationUpdater, provider)
        {
            _openFileInteractionHelper = openFileInteractionHelper;
            _scriptActionHelper        = scriptActionHelper;

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

                var tokens = new List <string>(TokenReplacer.GetTokenNames(true));
                ParameterTokenViewModel  = new TokenViewModel(x => CurrentProfile.Scripting.ParameterString = x, () => CurrentProfile?.Scripting.ParameterString, tokens, ReplaceTokens);
                ScriptFileTokenViewModel = new TokenViewModel(x => CurrentProfile.Scripting.ScriptFile = x, () => CurrentProfile?.Scripting.ScriptFile, tokens, ReplaceTokens, SelectScriptFileAction);
                ParameterTokenViewModel.OnTextChanged  += TokenTextChanged;
                ScriptFileTokenViewModel.OnTextChanged += TokenTextChanged;
                TokenTextChanged(this, EventArgs.Empty);
            }
        }
Exemplo n.º 20
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.º 21
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.º 22
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.º 23
0
        public DefaultViewerViewModel(
            ITranslationUpdater translationUpdater,
            ICurrentSettings <ObservableCollection <DefaultViewer> > defaultViewerProvider,
            ICurrentSettingsProvider currentSettingsProvider,
            IGpoSettings gpoSettings,
            IOpenFileInteractionHelper fileInteractionHelper)
            : base(translationUpdater)
        {
            _defaultViewerProvider   = defaultViewerProvider;
            _currentSettingsProvider = currentSettingsProvider;
            _fileInteractionHelper   = fileInteractionHelper;
            GpoSettings = gpoSettings;

            if (_defaultViewers != null)
            {
                UpdateDefaultViewer();
            }

            FindPathCommand = new DelegateCommand(ExecuteFindPath);
        }
Exemplo n.º 24
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.º 25
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);
        }
Exemplo n.º 26
0
        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 CoverUserControlViewModel(IOpenFileInteractionHelper openFileInteractionHelper, ITranslationUpdater translationUpdater, ISelectedProfileProvider selectedProfile) : base(translationUpdater, selectedProfile)
        {
            _openFileInteractionHelper = openFileInteractionHelper;

            SelectCoverCommand = new DelegateCommand(SelectCoverExecute);
        }
 public TokenButtonFunctionProvider(IInteractionInvoker interactionInvoker, IOpenFileInteractionHelper openFileInteractionHelper)
 {
     _interactionInvoker        = interactionInvoker;
     _openFileInteractionHelper = openFileInteractionHelper;
 }