public SignaturePasswordViewModel(ISignaturePasswordCheck passwordCheck)
        {
            _signaturePasswordCheck = passwordCheck;

            StorePasswordCommand  = new DelegateCommand(ExecuteStorePasswordCommand, CanExecuteStorePasswordCommand);
            SkipCommand           = new DelegateCommand(ExecuteSkipCommand);
            RemovePasswordCommand = new DelegateCommand(ExecuteRemovePasswordCommand);
        }
        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();
        }
Пример #3
0
        public void SetUp()
        {
            _th = new TestHelper(null);
            _th.InitTempFolder(nameof(SignaturePasswordCheckTest));
            _certificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12);
            _password        = "******";

            _signaturePasswordCheck = new SignaturePasswordCheck();
        }
Пример #4
0
        public SignaturePasswordViewModel(ISignaturePasswordCheck passwordCheck, SignaturePasswordWindowTranslation translation)
        {
            Translation             = translation;
            _signaturePasswordCheck = passwordCheck;

            StorePasswordCommand  = new DelegateCommand(ExecuteStorePasswordCommand, CanExecuteStorePasswordCommand);
            SkipCommand           = new DelegateCommand(ExecuteSkipCommand);
            RemovePasswordCommand = new DelegateCommand(ExecuteRemovePasswordCommand);
        }
        public void Setup()
        {
            _signaturePasswordCheck = Substitute.For <ISignaturePasswordCheck>();
            _conversionProfile      = new ConversionProfile();
            _conversionProfile.PdfSettings.Signature.Enabled         = true;
            _conversionProfile.PdfSettings.Signature.CertificateFile = _fixture.Create <string>();

            _job = new Job(null, _conversionProfile, new JobTranslations(), new Accounts());
            _job.Passwords.PdfSignaturePassword = _fixture.Create <string>();

            _step = new SignaturePasswordStep(_signaturePasswordCheck);
        }
        public void Setup()
        {
            var certificateFile = _fixture.Create <string>();

            _validSignaturePassword = _fixture.Create <string>();

            _passwordCheck = Substitute.For <ISignaturePasswordCheck>();
            _passwordCheck.IsValidPassword(certificateFile, _validSignaturePassword).Returns(true);

            _conversionProfile = new ConversionProfile();
            _conversionProfile.PdfSettings.Signature.Enabled         = true;
            _conversionProfile.PdfSettings.Signature.CertificateFile = certificateFile;

            _job = new Job(new JobInfo(), _conversionProfile, null);

            _viewModel = BuildViewModel();
            _viewModel.ExecuteWorkflowStep(_job);
        }
Пример #7
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();
        }
Пример #8
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);
        }
        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();
        }
Пример #10
0
 public InteractiveWorkflowManagerFactory(IWorkflowNavigationHelper workflowNavigationHelper, ISignaturePasswordCheck signaturePasswordCheck, IUpdateHelper updateHelper)
 {
     _workflowNavigationHelper = workflowNavigationHelper;
     _signaturePasswordCheck   = signaturePasswordCheck;
     _updateHelper             = updateHelper;
 }
 public SignaturePasswordViewModel(ISignaturePasswordCheck passwordCheck)
     : this()
 {
     SignaturePasswordCheck = passwordCheck;
 }
Пример #12
0
 public SignaturePasswordOverlayViewModel(ITranslationUpdater translationUpdater, ISignaturePasswordCheck signaturePasswordCheck) : base(translationUpdater)
 {
     _signaturePasswordCheck = signaturePasswordCheck;
 }
Пример #13
0
 public SignaturePasswordStepViewModel(ITranslationUpdater translationUpdater, ISignaturePasswordCheck signaturePasswordCheck) : base(translationUpdater, nameof(JobPasswords.PdfSignaturePassword))
 {
     _signaturePasswordCheck = signaturePasswordCheck;
 }
 protected SignaturePasswordViewModel(ITranslationUpdater translationUpdater, ISignaturePasswordCheck signaturePasswordCheck) : base(translationUpdater)
 {
     _signaturePasswordCheck = signaturePasswordCheck;
 }
Пример #15
0
 public InteractiveWorkflowManagerFactoryWithProfessionalHintHintStep(IWorkflowNavigationHelper workflowNavigationHelper, IProfessionalHintHelper professionalHintHelper, ISignaturePasswordCheck signaturePasswordCheck, IUpdateHelper updateHelper)
     : base(workflowNavigationHelper, signaturePasswordCheck, updateHelper)
 {
     _workflowNavigationHelper = workflowNavigationHelper;
     _professionalHintHelper   = professionalHintHelper;
 }
 public InteractiveWorkflowManagerFactoryWithPlusHintStep(IWorkflowNavigationHelper workflowNavigationHelper, IPlusHintHelper plusHintHelper, ISignaturePasswordCheck signaturePasswordCheck, IUpdateAssistant updateAssistant)
     : base(workflowNavigationHelper, signaturePasswordCheck, updateAssistant)
 {
     _workflowNavigationHelper = workflowNavigationHelper;
     _plusHintHelper           = plusHintHelper;
 }
Пример #17
0
 public SignaturePasswordStep(ISignaturePasswordCheck signaturePasswordCheck)
 {
     _signaturePasswordCheck = signaturePasswordCheck;
 }