public void TokenReplacer_GetTokenNames_ContainsTokenNameWithDelimiter() { var tr = new TokenReplacer(); var t = new StringToken("testName", "testValue"); tr.AddToken(t); Assert.Contains("<" + t.GetName() + ">", tr.GetTokenNames()); }
public void TokenReplacer_GetTokenNames_ContainsTokenName() { var tr = new TokenReplacer(); var t = new StringToken("testName", "testValue"); tr.AddToken(t); Assert.Contains(t.GetName(), tr.GetTokenNames(false)); }
public ScriptActionControl() { _tokenReplacer = TokenHelper.TokenReplacerWithPlaceHolders; Tokens = new List <string>(_tokenReplacer.GetTokenNames(true)); InitializeComponent(); DisplayName = TranslationHelper.Instance.TranslatorInstance.GetTranslation("ScriptActionSettings", "DisplayName", "Run script"); Description = TranslationHelper.Instance.TranslatorInstance.GetTranslation("ScriptActionSettings", "Description", "The script action runs a custom script or application after the conversion. This allows you to further process the output."); TranslationHelper.Instance.TranslatorInstance.Translate(this); }
public FtpActionControl(TokenReplacer tokenReplacer) { _tokenReplacer = tokenReplacer; Tokens = new List <string>(_tokenReplacer.GetTokenNames(true)); InitializeComponent(); DisplayName = TranslationHelper.Instance.TranslatorInstance.GetTranslation("FtpActionSettings", "DisplayName", "Upload with FTP"); Description = TranslationHelper.Instance.TranslatorInstance.GetTranslation("FtpActionSettings", "Description", "The FTP action allows to upload the created documents to a server via FTP."); TranslationHelper.Instance.TranslatorInstance.Translate(this); }
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); } }
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 FtpActionViewModel(ITranslator translator, IInteractionInvoker interactionInvoker) { _interactionInvoker = interactionInvoker; Translator = translator; SetPasswordCommand = new DelegateCommand(SetPasswordExecute); DisplayName = Translator.GetTranslation("FtpActionSettings", "DisplayName"); Description = Translator.GetTranslation("FtpActionSettings", "Description"); var tokenHelper = new TokenHelper(Translator); TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; TokenViewModel = new TokenViewModel(x => CurrentProfile.Ftp.Directory = x, () => CurrentProfile?.Ftp.Directory, TokenReplacer.GetTokenNames(true)); }
public FtpActionViewModel(FtpActionSettingsAndActionTranslation translation, IInteractionInvoker interactionInvoker, TokenHelper tokenHelper) { _interactionInvoker = interactionInvoker; Translation = translation; SetPasswordCommand = new DelegateCommand(SetPasswordExecute); DisplayName = Translation.DisplayName; Description = Translation.Description; TokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; TokenViewModel = new TokenViewModel(x => CurrentProfile.Ftp.Directory = x, () => CurrentProfile?.Ftp.Directory, TokenReplacer.GetTokenNames(true)); }
public FtpActionViewModel(TokenHelper tokenHelper, ITranslationUpdater translationUpdater, ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator) : base(translationUpdater, currentSettingsProvider) { if (tokenHelper != null) { _tokenReplacer = tokenHelper.TokenReplacerWithPlaceHolders; DirectoryTokenViewModel = new TokenViewModel(x => CurrentProfile.Ftp.Directory = x, () => CurrentProfile?.Ftp.Directory, _tokenReplacer.GetTokenNames(true), ReplaceTokens); } if (currentSettingsProvider?.Settings != null) { _ftpAccounts = currentSettingsProvider.Settings.ApplicationSettings.Accounts.FtpAccounts; FtpAccountsView = new ListCollectionView(_ftpAccounts); FtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(FtpAccount.AccountInfo), ListSortDirection.Ascending)); } AddAccountCommand = commandLocator.GetMacroCommand() .AddCommand <FtpAccountAddCommand>() .AddCommand(new DelegateCommand(o => SelectNewAccountInView())); EditAccountCommand = commandLocator.GetMacroCommand() .AddCommand <FtpAccountEditCommand>() .AddCommand(new DelegateCommand(o => RefreshAccountsView())); }