Ejemplo n.º 1
0
        private void Start(ICommandRuntime commandRuntime)
        {
            _log.Trace("Creating the Autofac container");
            _container = BuildContainer();
            RegisterAdditionalModules();
            ICommandLocator commandLocator = _container.Resolve <ICommandLocator>();
            string          commandName    = ExtractCommandName(ref _commandLineArguments);

            _log.TraceFormat("Finding the command: {0}", commandName);
            Lazy <ICommand, CommandMetadata> lazy = commandLocator.Find(commandName);

            if (lazy == null)
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    lazy = commandLocator.Find("run");
                }
                else
                {
                    lazy = commandLocator.Find("help");
                    Environment.ExitCode = -1;
                }
            }
            _commandInstance = lazy.Value;
            _log.TraceFormat("Executing command: {0}", _commandInstance.GetType().Name);
            _commandInstance.Start(_commandLineArguments, commandRuntime, CommonOptions);
        }
Ejemplo n.º 2
0
        public SmtpActionViewModel(IInteractionRequest interactionRequest, ISmtpTest smtpTest, ITranslationUpdater updater, ICurrentSettingsProvider currentSettingsProvider,
                                   ICommandLocator commandLocator, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher) : base(updater, currentSettingsProvider, dispatcher)
        {
            _interactionRequest      = interactionRequest;
            _smtpTest                = smtpTest;
            _currentSettingsProvider = currentSettingsProvider;

            SetTokenViewModel(tokenViewModelFactory);

            if (currentSettingsProvider?.Settings != null)
            {
                _smtpAccounts    = currentSettingsProvider.Settings.ApplicationSettings.Accounts.SmtpAccounts;
                SmtpAccountsView = new ListCollectionView(_smtpAccounts);
                SmtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(SmtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            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 DelegateCommand(TextSmtpExecute);
        }
Ejemplo n.º 3
0
        public AccountsViewModel(ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator, ITranslationUpdater translationUpdater, IDispatcher dispatcher, IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _currentSettingsProvider = currentSettingsProvider;
            _dispatcher  = dispatcher;
            _gpoSettings = gpoSettings;

            ConflateAllAccounts(_currentSettingsProvider.Settings);

            FtpAccountAddCommand    = commandLocator.GetCommand <FtpAccountAddCommand>();
            FtpAccountRemoveCommand = commandLocator.GetCommand <FtpAccountRemoveCommand>();
            FtpAccountEditCommand   = commandLocator.GetCommand <FtpAccountEditCommand>();

            SmtpAccountAddCommand    = commandLocator.GetCommand <SmtpAccountAddCommand>();
            SmtpAccountRemoveCommand = commandLocator.GetCommand <SmtpAccountRemoveCommand>();
            SmtpAccountEditCommand   = commandLocator.GetCommand <SmtpAccountEditCommand>();

            HttpAccountAddCommand    = commandLocator.GetCommand <HttpAccountAddCommand>();
            HttpAccountRemoveCommand = commandLocator.GetCommand <HttpAccountRemoveCommand>();
            HttpAccountEditCommand   = commandLocator.GetCommand <HttpAccountEditCommand>();

            DropboxAccountAddCommand    = commandLocator.GetCommand <DropboxAccountAddCommand>();
            DropboxAccountRemoveCommand = commandLocator.GetCommand <DropboxAccountRemoveCommand>();

            TimeServerAccountAddCommand    = commandLocator.GetCommand <TimeServerAccountAddCommand>();
            TimeServerAccountRemoveCommand = commandLocator.GetCommand <TimeServerAccountRemoveCommand>();
            TimeServerAccountEditCommand   = commandLocator.GetCommand <TimeServerAccountEditCommand>();

            if (_currentSettingsProvider != null)
            {
                _currentSettingsProvider.SelectedProfileChanged += CurrentSettingsProviderOnSelectedProfileChanged;
            }
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     _translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());
     _plusHintHelper     = Substitute.For <IPlusHintHelper>();
     _commandLocator     = Substitute.For <ICommandLocator>();
     InitViewModel();
 }
Ejemplo n.º 5
0
        public FtpActionViewModel(ITranslationUpdater translationUpdater,
                                  ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                  ICurrentSettingsProvider currentSettingsProvider,
                                  ICommandLocator commandLocator,
                                  ITokenViewModelFactory tokenViewModelFactory,
                                  IDispatcher dispatcher,
                                  IGpoSettings gpoSettings)

            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _gpoSettings            = gpoSettings;
            DirectoryTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();

            _ftpAccounts = accountsProvider?.Settings.FtpAccounts;

            if (_ftpAccounts != null)
            {
                FtpAccountsView = new ListCollectionView(_ftpAccounts);
                FtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(FtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            AddAccountCommand = commandLocator.CreateMacroCommand()
                                .AddCommand <FtpAccountAddCommand>()
                                .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                .Build();

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <FtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            _profile = new ConversionProfile();

            _job = new Job(null, null, null)
            {
                Profile     = _profile,
                OutputFiles = new List <string> {
                    "FirstFile.pdf"
                }
            };

            _fileList = new List <string>();
            _fileList.Add("C:\\Kartoffel.pdf");
            _fileList.Add("C:\\Salat.jpg");
            _fileList.Add("C:\\Marvin.tiff");
            _fileAssoc           = Substitute.For <IFileAssoc>();
            _defaultViewerAction = Substitute.For <IDefaultViewerAction>();
            _commandLocator      = Substitute.For <ICommandLocator>();
            _settingsProvider    = Substitute.For <ISettingsProvider>();
            var pdfCreatorSettings = new PdfCreatorSettings();

            pdfCreatorSettings.ApplicationSettings = new ApplicationSettings();
            pdfCreatorSettings.DefaultViewers.Add(new DefaultViewer {
                IsActive = true, OutputFormat = OutputFormat.Pdf
            });
            _settingsProvider.Settings.Returns(pdfCreatorSettings);
            _interactionInvoker = Substitute.For <IInteractionInvoker>();
        }
 public UsageStatisticsViewModel(IOsHelper osHelper, ICommandLocator commandLocator,
                                 ICurrentSettingsProvider currentSettingsProvider, IGpoSettings gpoSettings, IUsageMetricFactory usageMetricFactory,
                                 ICurrentSettings <Conversion.Settings.UsageStatistics> usageStatisticsProvider, ITranslationUpdater translationUpdater, ApplicationNameProvider applicationNameProvider)
     : base(osHelper, currentSettingsProvider, gpoSettings, translationUpdater, usageStatisticsProvider, commandLocator, applicationNameProvider)
 {
     _usageMetricFactory = usageMetricFactory;
 }
Ejemplo n.º 8
0
        public HttpActionViewModel(ITranslationUpdater translationUpdater,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICommandLocator commandLocator,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _gpoSettings  = gpoSettings;
            _httpAccounts = accountsProvider?.Settings.HttpAccounts;
            if (_httpAccounts != null)
            {
                HttpAccountsView = new ListCollectionView(_httpAccounts);
                HttpAccountsView.SortDescriptions.Add(new SortDescription(nameof(HttpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            AddAccountCommand = commandLocator.CreateMacroCommand()
                                .AddCommand <HttpAccountAddCommand>()
                                .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                .Build();

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <HttpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();
        }
Ejemplo n.º 9
0
        public DropboxUserControlViewModel(ITranslationUpdater translationUpdater,
                                           ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                           ICurrentSettingsProvider currentSettingsProvider,
                                           ICommandLocator commandLocator,
                                           ITokenViewModelFactory tokenViewModelFactory,
                                           IDispatcher dispatcher,
                                           IGpoSettings gpoSettings)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _translationUpdater      = translationUpdater;
            _tokenViewModelFactory   = tokenViewModelFactory;
            _gpoSettings             = gpoSettings;
            AddDropboxAccountCommand = commandLocator.CreateMacroCommand()
                                       .AddCommand <DropboxAccountAddCommand>()
                                       .AddCommand(new DelegateCommand(SelectNewAccountInView))
                                       .Build();

            DropboxAccounts = accountsProvider?.Settings.DropboxAccounts;

            _translationUpdater.RegisterAndSetTranslation(tf =>
            {
                SharedFolderTokenViewModel = _tokenViewModelFactory
                                             .BuilderWithSelectedProfile()
                                             .WithSelector(p => p.DropboxSettings.SharedFolder)
                                             .WithDefaultTokenReplacerPreview(th => th.GetTokenListForDirectory())
                                             .Build();
            });
        }
        public void Setup()
        {
            _invoker = Substitute.For <IInteractionInvoker>();

            IStorage storage            = Substitute.For <IStorage>();
            var      pdfCreatorSettings = new PdfCreatorSettings();

            _gpoSettings = Substitute.For <IGpoSettings>();

            _simpleSettingsProvider = Substitute.For <ISettingsProvider>();
            _simpleSettingsProvider.Settings.Returns(pdfCreatorSettings);
            _settingsManager = Substitute.For <ISettingsManager>();
            _settingsManager.GetSettingsProvider().Returns(_simpleSettingsProvider);

            _iniSettingsAssitant = Substitute.For <IIniSettingsAssistant>();

            _commandLocator = Substitute.For <ICommandLocator>();

            _loadCommand = Substitute.For <ICommand>();
            _loadCommand.When(x => x.Execute(Arg.Any <object>())).Do(info => _iniSettingsAssitant.LoadIniSettings());
            _commandLocator.GetCommand <LoadIniSettingsCommand>().Returns(_loadCommand);

            _saveCommand = Substitute.For <ICommand>();
            _saveCommand.When(x => x.Execute(Arg.Any <object>())).Do(info => _iniSettingsAssitant.SaveIniSettings());
            _commandLocator.GetCommand <SaveSettingsToIniCommand>().Returns(_saveCommand);

            _translationUpdater = new TranslationUpdater(new TranslationFactory(), new ThreadManager());
        }
Ejemplo n.º 11
0
 public FrequentTipsControlViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater)
 {
     _commandLocator = commandLocator;
     _isInitialized  = true;
     ComposeFrequentTipList();
     SetRandomTip();
 }
Ejemplo n.º 12
0
 public ProfileSubTabViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider profile, ICommandLocator commandLocator, IEnumerable <IActionFacade> tokens)
 {
     _translationUpdater = translationUpdater;
     Profile             = profile;
     _commandLocator     = commandLocator;
     _tokens             = tokens;
 }
Ejemplo n.º 13
0
 public AddActionViewModel(
     ICommandLocator commandLocator, IInteractionRequest interactionRequest,
     ITranslationUpdater translationUpdater) : base(translationUpdater)
 {
     _interactionRequest          = interactionRequest;
     OpenAddActionOverviewCommand = new DelegateCommand(OpenAddActionOverview);
 }
Ejemplo n.º 14
0
        public AccountsViewModel(
            ICurrentSettingsProvider currentSettingsProvider,
            ICurrentSettings <Conversion.Settings.Accounts> accountProvider,
            ICommandLocator commandLocator,
            ITranslationUpdater translationUpdater,
            IDispatcher dispatcher,
            IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _currentSettingsProvider = currentSettingsProvider;
            _dispatcher       = dispatcher;
            _gpoSettings      = gpoSettings;
            _accountsProvider = accountProvider;
            _commandLocator   = commandLocator;
            ConflateAllAccounts();

            FtpAccountAddCommand        = _commandLocator.GetCommand <FtpAccountAddCommand>();
            SmtpAccountAddCommand       = _commandLocator.GetCommand <SmtpAccountAddCommand>();
            HttpAccountAddCommand       = _commandLocator.GetCommand <HttpAccountAddCommand>();
            DropboxAccountAddCommand    = _commandLocator.GetCommand <DropboxAccountAddCommand>();
            TimeServerAccountAddCommand = _commandLocator.GetCommand <TimeServerAccountAddCommand>();

            RemoveSelectedAccountCommand = new DelegateCommand(OnRemoveSelectedCommand, CanRemoveSelectedCommand);

            EditSelectedAccountCommand = new DelegateCommand(OnEditSelectedCommand, CanEditSelectedCommand);

            AddAccountsToken = new List <AccountToken>
            {
                new AccountToken(SmtpAccountAddCommand, () => Translation.AddSmtpAccount, "EmailIcon"),
                new AccountToken(DropboxAccountAddCommand, () => Translation.AddDropboxAccount, "DropboxIcon"),
                new AccountToken(FtpAccountAddCommand, () => Translation.AddFtpAccount, "FtpIcon"),
                new AccountToken(HttpAccountAddCommand, () => Translation.AddHttpAccount, "HttpIcon"),
                new AccountToken(TimeServerAccountAddCommand, () => Translation.AddTimeServerAccount, "TimeServerIcon")
            };
        }
Ejemplo n.º 15
0
        public ProfilesViewModel(
            ISelectedProfileProvider selectedProfileProvider,
            ITranslationUpdater translationUpdater,
            ICommandLocator commandLocator,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profileProvider,
            IGpoSettings gpoSettings,
            IRegionManager regionManager,
            IWorkflowEditorSubViewProvider viewProvider,
            ICommandBuilderProvider commandBuilderProvider)
            : base(translationUpdater)
        {
            _profileProvider = profileProvider;
            _regionManager   = regionManager;
            _viewProvider    = viewProvider;

            GpoSettings             = gpoSettings;
            SelectedProfileProvider = selectedProfileProvider;

            ProfileRenameCommand = commandLocator.GetCommand <ProfileRenameCommand>();
            ProfileRemoveCommand = commandLocator.GetCommand <ProfileRemoveCommand>();

            var macroCommandBuilder = commandBuilderProvider.ProvideBuilder(commandLocator);

            ProfileAddCommand = macroCommandBuilder
                                .AddCommand <ProfileAddCommand>()
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.OutputFormatOverlay, t => t.OutputFormat))
                                .AddInitializedCommand <WorkflowEditorCommand>(
                c => c.Initialize(_viewProvider.SaveOverlay, t => t.Save))
                                .Build();
        }
Ejemplo n.º 16
0
 public ExportSettingsViewModel(
     ITranslationUpdater translationUpdater,
     ICommandLocator commandLocator,
     IGpoSettings gpoSettings) : base(translationUpdater, gpoSettings)
 {
     LoadIniSettingsCommand = commandLocator.GetCommand <LoadIniSettingsCommand>();
     SaveIniSettingsCommand = commandLocator.GetCommand <SaveSettingsToIniCommand>();
 }
Ejemplo n.º 17
0
        public void SetUp()
        {
            originalOutput = Console.Out;
            Console.SetOut(output = new StringWriter());

            commandLocator = Substitute.For<ICommandLocator>();
            helpCommand = new HelpCommand(commandLocator);
        }
Ejemplo n.º 18
0
        public ProfileSubTabViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider profile, ICommandLocator commandLocator)
        {
            _translationUpdater = translationUpdater;
            Profile             = profile;
            _commandLocator     = commandLocator;

            profile.SelectedProfileChanged += OnProfileOnSelectedProfileChanged;
        }
        public void SetUp()
        {
            var translationUpdater = new TranslationUpdater(new TranslationFactory(null), new ThreadManager());

            _commandLocator = Substitute.For <ICommandLocator>();

            _frequentTipsControlViewModel = new FrequentTipsControlViewModel(translationUpdater, _commandLocator);
        }
Ejemplo n.º 20
0
        public ProfileSubTabViewModel(ITranslationUpdater translationUpdater, ISelectedProfileProvider profile, ICommandLocator commandLocator)
        {
            _translationUpdater = translationUpdater;
            Profile             = profile;
            _commandLocator     = commandLocator;

            profile.SelectedProfileChanged += (sender, args) => RaisePropertyChanged(nameof(IsChecked));
        }
Ejemplo n.º 21
0
        public void SetUp()
        {
            originalOutput        = Console.Out;
            Console.SetOut(output = new StringWriter());

            commandLocator = Substitute.For <ICommandLocator>();
            helpCommand    = new HelpCommand(commandLocator);
        }
Ejemplo n.º 22
0
 public QuickActionViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator, IReadableFileSizeFormatter readableFileSizeHelper, ICurrentSettingsProvider currentSettingsProvider) : base(translationUpdater)
 {
     _commandLocator          = commandLocator;
     _readableFileSizeHelper  = readableFileSizeHelper;
     _currentSettingsProvider = currentSettingsProvider;
     StartQuickActionCommand  = new DelegateCommand(StartQuickActionCommandExecute);
     FinishCommand            = new DelegateCommand(OnFinish);
     InitList();
 }
        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();
        }
Ejemplo n.º 24
0
        public PrintJobViewModel(
            ISettingsProvider settingsProvider,
            ITranslationUpdater translationUpdater,
            IJobInfoQueue jobInfoQueue,
            ICommandLocator commandLocator,
            IEventAggregator eventAggregator,
            ISelectedProfileProvider selectedProfileProvider,
            ICurrentSettings <ObservableCollection <ConversionProfile> > profilesProvider,
            IGpoSettings gpoSettings,
            ITargetFilePathComposer targetFilePathComposer,
            IJobInfoManager jobInfoManager,
            IChangeJobCheckAndProceedCommandBuilder changeJobCheckAndProceedCommandBuilder,
            IBrowseFileCommandBuilder browseFileCommandBuilder,
            IDispatcher dispatcher,
            IJobDataUpdater jobDataUpdater)
            : base(translationUpdater)
        {
            GpoSettings              = gpoSettings;
            _settingsProvider        = settingsProvider;
            _commandLocator          = commandLocator;
            _eventAggregator         = eventAggregator;
            _selectedProfileProvider = selectedProfileProvider;
            _profilesProvider        = profilesProvider;
            _targetFilePathComposer  = targetFilePathComposer;
            _jobInfoManager          = jobInfoManager;

            _changeJobCheckAndProceedCommandBuilder = changeJobCheckAndProceedCommandBuilder;
            _dispatcher     = dispatcher;
            _jobDataUpdater = jobDataUpdater;
            _changeJobCheckAndProceedCommandBuilder.Init(() => Job, CallFinishInteraction, () => _lastConfirmedFilePath, s => _lastConfirmedFilePath = s);

            SetOutputFormatCommand = new DelegateCommand <OutputFormat>(SetOutputFormatExecute);

            browseFileCommandBuilder.Init(() => Job, UpdateUiForJobOutputFileTemplate, () => _lastConfirmedFilePath, s => _lastConfirmedFilePath = s);
            BrowseFileCommand = browseFileCommandBuilder.BuildCommand();
            SetupEditProfileCommand(_commandLocator, eventAggregator);

            SetupSaveCommands(translationUpdater);

            EmailCommand = _changeJobCheckAndProceedCommandBuilder.BuildCommand(EnableEmailSettings);
            SetupSendDropDownCommands(translationUpdater);

            MergeCommand = new DelegateCommand(MergeExecute);
            var mergeAllAsyncCommand = new AsyncCommand(MergeAllExecuteAsync, o => jobInfoQueue.Count > 1);

            MergeDropDownCommands = new CommandCollection <PrintJobViewTranslation>(translationUpdater);
            MergeDropDownCommands.AddCommand(mergeAllAsyncCommand, t => t.MergeAll);
            CancelCommand          = new DelegateCommand(CancelExecute);
            CancelDropDownCommands = new CommandCollection <PrintJobViewTranslation>(translationUpdater);
            CancelDropDownCommands.AddCommand(new DelegateCommand(CancelAllExecute, o => jobInfoQueue.Count > 1), t => t.CancelAll);

            DisableSaveTempOnlyCommand = new DelegateCommand(DisableSaveFileTemporary);

            jobInfoQueue.OnNewJobInfo += (sender, args) => UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);
            _jobInfoQueue              = jobInfoQueue;
            UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);
        }
Ejemplo n.º 25
0
        public PrintJobViewModel(
            ISettingsProvider settingsProvider,
            ITranslationUpdater translationUpdater,
            IJobInfoQueue jobInfoQueue,
            IFileNameQuery saveFileQuery,
            IInteractionRequest interactionRequest,
            IProfileChecker profileChecker,
            ErrorCodeInterpreter errorCodeInterpreter,
            ICommandLocator commandsLocator,
            IEventAggregator eventAggregator,
            ISelectedProfileProvider selectedProfileProvider,
            ITempFolderProvider tempFolderProvider,
            IPathUtil pathUtil,
            IFile file,
            IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            GpoSettings              = gpoSettings;
            _settingsProvider        = settingsProvider;
            _saveFileQuery           = saveFileQuery;
            _profileChecker          = profileChecker;
            _interactionRequest      = interactionRequest;
            _errorCodeInterpreter    = errorCodeInterpreter;
            _selectedProfileProvider = selectedProfileProvider;
            _file = file;
            _tempFolderProvider = tempFolderProvider;
            _pathUtil           = pathUtil;

            SaveCommand            = new DelegateCommand(SaveExecute);
            SendByEmailCommand     = new DelegateCommand(EmailExecute);
            MergeCommand           = new DelegateCommand(MergeExecute);
            CancelCommand          = new DelegateCommand(CancelExecute);
            SetOutputFormatCommand = new DelegateCommand <OutputFormat>(SetOutputFormatExecute);
            BrowseFileCommand      = new DelegateCommand(BrowseFileExecute);

            SetupEditProfileCommand(commandsLocator, eventAggregator);

            var settings = settingsProvider.Settings?.CopyAndPreserveApplicationSettings();

            Profiles = settings?.ConversionProfiles;

            jobInfoQueue.OnNewJobInfo += (sender, args) => UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);
            UpdateNumberOfPrintJobsHint(jobInfoQueue.Count);

            var profileListView = CollectionViewSource.GetDefaultView(Profiles);

            if (profileListView != null)
            {
                profileListView.CurrentChanged += (sender, args) =>
                {
                    if (Job != null)
                    {
                        OutputFormat = ((ConversionProfile)profileListView.CurrentItem).OutputFormat;
                    }
                };
            }
        }
Ejemplo n.º 26
0
        public QuickActionOpenWithDefaultCommand(ITranslationUpdater translationUpdater, IDefaultViewerAction action, IFileAssoc fileAssoc, ICommandLocator commandLocator, ISettingsProvider settingsProvider, IInteractionInvoker interactionInvoker) : base(translationUpdater)

        {
            Action             = action;
            FileAssoc          = fileAssoc;
            CommandLocator     = commandLocator;
            SettingsProvider   = settingsProvider;
            InteractionInvoker = interactionInvoker;
        }
Ejemplo n.º 27
0
        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>();
        }
Ejemplo n.º 28
0
 public AddJob(
     ICommandLocator commandLocator,
     ICommandHydrator commandHydrator,
     IJobsDataService jobsDataService,
     ILoginService loginService) : base(loginService)
 {
     this.commandLocator  = commandLocator;
     this.commandHydrator = commandHydrator;
     this.jobsDataService = jobsDataService;
 }
Ejemplo n.º 29
0
 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 void SetUp()
        {
            originalOutput = Console.Out;
            output         = new StringWriter();
            Console.SetOut(output);

            commandLocator        = Substitute.For <ICommandLocator>();
            commandOutputProvider = new CommandOutputProvider(logger);
            helpCommand           = new HelpCommand(commandLocator, commandOutputProvider);
            logger = new LoggerConfiguration().WriteTo.TextWriter(output).CreateLogger();
        }
Ejemplo n.º 31
0
 public JsonRpcProcessor(
     ICommandLocator commandLocator,
     IJsonRpcCommandTranslator translator,
     IJsonRpcHttpConverter converter,
     IJsonRpcRequestParser requestParser)
 {
     this.commandLocator = commandLocator;
     this.requestParser  = requestParser;
     this.translator     = translator;
     this.converter      = converter;
 }
Ejemplo n.º 32
0
        static ICommand GetCommand(string first, ICommandLocator commandLocator)
        {
            if (string.IsNullOrWhiteSpace(first))
            {
                return commandLocator.Find("help");
            }

            var command = commandLocator.Find(first);
            if (command == null)
                throw new CommandException("Error: Unrecognized command '" + first + "'");

            return command;
        }
Ejemplo n.º 33
0
 public CommandProcessor(ICommandLocator commandLocator, ILog log)
 {
     this.commandLocator = commandLocator;
     this.log = log;
 }
 public ClientRequestProcessor(ICommandLocator commandLocator, IRequestParser requestParser)
 {
     _commandLocator = commandLocator;
     _requestParser = requestParser;
 }
Ejemplo n.º 35
0
 public HelpCommand(ICommandLocator commands)
 {
     this.commands = commands;
 }
Ejemplo n.º 36
0
 public CommandExecutionContext(ICommandLocator commandLocator, IHelpTopicLocator helpLocator)
 {
     _commandLocator = commandLocator;
     _helpLocator = helpLocator;
 }