public void Initialize_CommandLocatorSetsShowManualCommandWithCorrectHelpTopic() { var userGuideGeneralCommand = Substitute.For <ICommand>(); _commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.General).Returns(userGuideGeneralCommand); InitAboutViewModel(); Assert.AreSame(userGuideGeneralCommand, _aboutViewModel.ShowManualCommand); }
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>(); }
public FrequentTip ComposeF1HelpTip() { var frequentBannerElement = new FrequentTip(); frequentBannerElement.Title = Translation.F1HelpTitle; frequentBannerElement.Text = Translation.F1HelpText; frequentBannerElement.Command = _commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.General); return(frequentBannerElement); }
protected UsageStatisticsViewModelBase(IOsHelper osHelper, ICurrentSettingsProvider currentSettingsProvider, IGpoSettings gpoSettings, ITranslationUpdater translationUpdater, ICurrentSettings <Conversion.Settings.UsageStatistics> usageStatisticsProvider, ICommandLocator commandLocator, ApplicationNameProvider applicationNameProvider) : base(translationUpdater, currentSettingsProvider, gpoSettings) { OsHelper = osHelper; UsageStatisticsProvider = usageStatisticsProvider; _applicationNameProvider = applicationNameProvider; ShowUserGuideCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic); VisitWebsiteCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PrivacyPolicyUrl); }
public void ComposeAutoSaveTip_Test() { var expectedCommand = Substitute.For <ICommand>(); //Set condition for command locator to return expectedCommand _commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.Tip_AutoSaveUrl).Returns(expectedCommand); var frequentTip = _frequentTipsControlViewModel.ComposeAutoSaveTip(); Assert.AreEqual(_translation.AutoSaveTitle, frequentTip.Title, "Title"); Assert.AreEqual(_translation.AutoSaveText, frequentTip.Text, "Text"); Assert.AreEqual(expectedCommand, frequentTip.Command, "Command"); }
public AboutViewModel(IVersionHelper versionHelper , ITranslationUpdater translationUpdater , ICommandLocator commandLocator, ApplicationNameProvider applicationNameProvider, EditionHelper editionHelper) : base(translationUpdater) { ApplicationNameProvider = applicationNameProvider; VersionText = versionHelper.FormatWithBuildNumber(); ShowManualCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.General); ShowLicenseCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.License); PdfforgeWebsiteCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PdfforgeWebsiteUrl); IsLicensedVersion = !editionHelper?.ShowOnlyForPlusAndBusiness ?? true; PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>(); }
public AboutViewModel(IVersionHelper versionHelper , ButtonDisplayOptions buttonDisplayOptions, ITranslationUpdater translationUpdater , ICommandLocator commandLocator, ApplicationNameProvider applicationNameProvider) : 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); }
public TitleReplacementEditUserControlViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater) { IsRemoveAll = true; OkCommand = new DelegateCommand(ExecuteOkCommand); CancelCommand = new DelegateCommand(ExecuteCancelCommand); ShowUserGuideCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.AppTitle); }
public void Initialize_CommandLocatorSetsPlusHintUrlWithCorrectUrl() { var plusHintUrlCommand = Substitute.For <ICommand>(); _commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PlusHintLink).Returns(plusHintUrlCommand); InitPlusHintViewModel(); Assert.AreSame(plusHintUrlCommand, _plusHintViewModel.UrlOpenCommand); }
private FrequentTip ComposeTip <TCommand, TParameter>(string title, string body, TParameter parameter) where TCommand : class, IInitializedCommand <TParameter> { var composedTip = new FrequentTip(); composedTip.Title = title; composedTip.Text = body; composedTip.Command = _commandLocator.GetInitializedCommand <TCommand, TParameter>(parameter); return(composedTip); }
public LanguageSelectionSettingsViewModel(IGpoSettings gpoSettings, ICurrentSettings <ApplicationSettings> appSettingsProvider, ICurrentSettingsProvider currentSettingsProvider, ILanguageProvider languageProvider, ITranslationHelper translationHelper, ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater, currentSettingsProvider, gpoSettings) { _appSettingsProvider = appSettingsProvider; _translationHelper = translationHelper; _commandLocator = commandLocator; Languages = languageProvider.GetAvailableLanguages().ToList(); VisitWebsiteCommand = _commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PdfforgeTranslationUrl); SettingsProvider.SettingsChanged += (sender, args) => RaisePropertyChanged(nameof(CurrentLanguage)); }
public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater, EditionHelper editionHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider) : base(translationUpdater) { _versionHelper = versionHelper; _applicationNameProvider = applicationNameProvider; AllowPrioritySupport = !editionHelper?.ShowOnlyForPlusAndBusiness ?? true; WhatsNewCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew); PrioritySupportCommand = commandLocator.GetCommand <PrioritySupportUrlOpenCommand>(); }
public WelcomeViewModel(ICommandLocator commandLocator, ITranslationUpdater translationUpdater, EditionHelper editionHelper, IVersionHelper versionHelper, ApplicationNameProvider applicationNameProvider) : base(translationUpdater) { _editionHelper = editionHelper; _versionHelper = versionHelper; _applicationNameProvider = applicationNameProvider; WhatsNewCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic.WhatsNew); PrioritySupportCommand = commandLocator.GetCommand <IPrioritySupportUrlOpenCommand>(); }
protected UsageStatisticsViewModelBase(IVersionHelper versionHelper, IOsHelper osHelper, ICurrentSettingsProvider currentSettingsProvider, IGpoSettings gpoSettings, IProcessStarter processStarter, ITranslationUpdater translationUpdater, ICurrentSettings <UsageStatistics> usageStatisticsProvider, ApplicationNameProvider applicationNameProvider, ICommandLocator commandLocator) : base(translationUpdater, currentSettingsProvider, gpoSettings) { VersionHelper = versionHelper; OsHelper = osHelper; _processStarter = processStarter; UsageStatisticsProvider = usageStatisticsProvider; _applicationNameProvider = applicationNameProvider; ShowUserGuideCommand = commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(HelpTopic); }
public void PlusHintCommand_Execute_ExcutesPlusHintWebsiteCommandAndCallsFinishesInteraction_DoesNotThrowAbortWorkflowException() { var plusHintWebsiteCommand = Substitute.For <ICommand>(); _commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PlusHintLink).Returns(plusHintWebsiteCommand); InitViewModel(); var wasCalled = false; _plusHintViewModel.StepFinished += (sender, args) => wasCalled = true; Assert.DoesNotThrow(() => _plusHintViewModel.PlusButtonCommand.Execute(null), "May not throw AbortWorkflowException!"); plusHintWebsiteCommand.Received().Execute(Arg.Any <object>()); Assert.IsTrue(wasCalled, "StepFinished was not invoked"); }
public ProfessionalHintStepViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator, IProfessionalHintHelper professionalHintHelper) : base(translationUpdater) { _professionalHintHelper = professionalHintHelper; FinishStepCommand = new DelegateCommand(o => CancelExecute()); ProfessionalHintCommand = new CompositeCommand(); //compose "open plus hint url" and "call step finsihed" var urlOpenCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.ProfessionalHintUrl); if (urlOpenCommand != null) //required to avoid NullException in DesignTimeViewModel { ProfessionalHintCommand.RegisterCommand(urlOpenCommand); } ProfessionalHintCommand.RegisterCommand(new DelegateCommand(o => InvokeStepFinished())); }
public void SwitchLicenseCommand(HelpTopic topic) { ShowLicenseCommand = _commandLocator.GetInitializedCommand <ShowUserGuideCommand, HelpTopic>(topic); }
public BusinessHintStatusBarViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater) { UrlOpenCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.BusinessHintLink); }
public PlusHintViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater) { UrlOpenCommand = commandLocator.GetInitializedCommand <UrlOpenCommand, string>(Urls.PlusHintLink); }