コード例 #1
0
 public PlusFeatureControlViewModel(EditionHintOptionProvider editionHintOptionProvider, IProcessStarter processStarter, ITranslationUpdater translationUpdater)
     : base(translationUpdater)
 {
     _processStarter = processStarter;
     ShowPlusHint    = editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
     RaisePropertyChanged(nameof(ShowPlusHint));
 }
コード例 #2
0
        public void SetUp()
        {
            _interactionRequest = new UnitTestInteractionRequest();
            var fileWrap = Substitute.For <IFile>();
            var openFileInteractionHelper = Substitute.For <IOpenFileInteractionHelper>();
            var editionHintOptionProvider = new EditionHintOptionProvider(false, false);
            var translationUpdater        = new TranslationUpdater(new TranslationFactory(null), new ThreadManager());
            var settingsProvider          = Substitute.For <ICurrentSettingsProvider>();

            var settings = new PdfCreatorSettings(null);

            _timeServerAccounts = new ObservableCollection <TimeServerAccount>();
            settings.ApplicationSettings.Accounts.TimeServerAccounts = _timeServerAccounts;
            settingsProvider.Settings.Returns(settings);

            var commandLocator = Substitute.For <ICommandLocator>();

            commandLocator = Substitute.For <ICommandLocator>();
            commandLocator.GetMacroCommand().Returns(x => new MacroCommand(commandLocator));

            _timeServerAddCommand = Substitute.For <ICommand>();
            commandLocator.GetCommand <TimeServerAccountAddCommand>().Returns(_timeServerAddCommand);

            _timeServerEditCommand = Substitute.For <ICommand>();
            commandLocator.GetCommand <TimeServerAccountEditCommand>().Returns(_timeServerEditCommand);

            _viewModel = new SignUserControlViewModel(_interactionRequest, fileWrap, openFileInteractionHelper,
                                                      editionHintOptionProvider, translationUpdater, settingsProvider,
                                                      settingsProvider, commandLocator);
        }
コード例 #3
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());
        }
コード例 #4
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();
        }
コード例 #5
0
        public EncryptUserControlViewModel
        (
            IInteractionRequest interactionRequest,
            EditionHintOptionProvider editionHintOptionProvider,
            IUserGuideHelper userGuideHelper,
            ITranslationUpdater translationUpdater,
            ISelectedProfileProvider selectedProfile
        )
            : base(translationUpdater, selectedProfile)
        {
            _interactionRequest = interactionRequest;
            _userGuideHelper    = userGuideHelper;

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

            SecurityPasswordCommand = new DelegateCommand(SecurityPasswordExecute);
        }
コード例 #6
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();
        }
コード例 #7
0
        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()));
        }
コード例 #8
0
        public SaveTabViewModel(TokenButtonFunctionProvider buttonFunctionProvider, ISelectedProfileProvider selectedProfileProvider, ITranslationUpdater translationUpdater, EditionHintOptionProvider editionHintOptionProvider, TokenHelper tokenHelper)
            : base(translationUpdater, selectedProfileProvider)
        {
            AllowSkipPrintDialog    = !editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
            _buttonFunctionProvider = buttonFunctionProvider;
            _tokenHelper            = tokenHelper;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels());
            selectedProfileProvider.SelectedProfileChanged += (sender, args) => SetTokenViewModels();
        }
コード例 #9
0
ファイル: WelcomeViewModel.cs プロジェクト: sm2x/PDFCreator
        public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater, EditionHintOptionProvider editionHintOptionProvider)
            : base(translationUpdater)
        {
            AllowPrioritySupport = !editionHintOptionProvider?.ShowOnlyForPlusAndBusinessHint ?? true;

            WhatsNewCommand        = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew);
            BlogCommand            = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.Blog);
            PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>();
        }
コード例 #10
0
ファイル: AboutViewModel.cs プロジェクト: sm2x/PDFCreator
        public AboutViewModel(IVersionHelper versionHelper
                              , ButtonDisplayOptions buttonDisplayOptions, ITranslationUpdater translationUpdater
                              , ICommandLocator commandLocator, ApplicationNameProvider applicationNameProvider, EditionHintOptionProvider editionHintOptionProvider) : base(translationUpdater)
        {
            ApplicationNameProvider = applicationNameProvider;
            HideSocialMediaButtons  = buttonDisplayOptions.HideSocialMediaButtons;
            VersionText             = versionHelper.FormatWithBuildNumber();

            ShowManualCommand  = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.General);
            ShowLicenseCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.License);

            PdfforgeWebsiteCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PdfforgeWebsiteUrl);
            FacebookCommand        = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.Facebook);
            GooglePlusCommand      = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.GooglePlus);
            AllowPrioritySupport   = !editionHintOptionProvider?.ShowOnlyForPlusAndBusinessHint ?? true;
            PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>();
        }
コード例 #11
0
 public NotificationsLevelSettingsViewModel(ICurrentSettingsProvider settingsProvider,
                                            IGpoSettings gpoSettings, ITranslationUpdater translationUpdater, EditionHintOptionProvider editionHintOptionProvider, IDispatcher dispatcher) :
     base(translationUpdater, settingsProvider, dispatcher)
 {
     AllowNotifications = !editionHintOptionProvider.ShowOnlyForPlusAndBusinessHint;
 }