Exemple #1
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);
        }
Exemple #2
0
        public FtpActionViewModel(TokenHelper tokenHelper, ITranslationUpdater translationUpdater, ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            // TODO update on translation change!
            DirectoryTokenViewModel = tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();

            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.CreateMacroCommand()
                                .AddCommand <FtpAccountAddCommand>()
                                .AddCommand(new DelegateCommand(o => SelectNewAccountInView()))
                                .Build();

            EditAccountCommand = commandLocator.CreateMacroCommand()
                                 .AddCommand <FtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();
        }
Exemple #3
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();
        }
        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();
        }
Exemple #5
0
        public SettingControlsViewModel(ITranslationUpdater translationUpdater, ICommandLocator commandLocator) : base(translationUpdater)
        {
            SaveCommand = commandLocator.CreateMacroCommand()
                          .AddCommand <EvaluateSavingRelevantSettingsAndNotifyUserCommand>()
                          .AddCommand <ISaveChangedSettingsCommand>()
                          .AddCommand <NavigateToMainTabCommand>()
                          .AddCommand <RaiseEditSettingsFinishedEventCommand>()
                          .Build();

            CancelCommand = commandLocator.CreateMacroCommand()
                            .AddCommand <CancelApplicationSettingsChangesCommand>()
                            .AddCommand <NavigateToMainTabCommand>()
                            .AddCommand <RaiseEditSettingsFinishedEventCommand>()
                            .Build();
        }
Exemple #6
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 SmtpActionViewModel(IInteractionRequest interactionRequest,
                                   ISmtpTest smtpTest,
                                   ITranslationUpdater updater,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICommandLocator commandLocator,
                                   ITokenViewModelFactory tokenViewModelFactory,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings,
                                   ISelectFilesUserControlViewModelFactory selectFilesUserControlViewModelFactory)
            : base(updater, currentSettingsProvider, dispatcher)
        {
            _interactionRequest = interactionRequest;
            _smtpTest           = smtpTest;
            _accountsProvider   = accountsProvider;
            _commandLocator     = commandLocator;
            _gpoSettings        = gpoSettings;

            _smtpAccounts = _accountsProvider?.Settings.SmtpAccounts;

            if (_smtpAccounts != null)
            {
                SmtpAccountsView = new ListCollectionView(_smtpAccounts);
                SmtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(SmtpAccount.AccountInfo), ListSortDirection.Ascending));
                SmtpAccountsView.CurrentChanged += (sender, args) => RaisePropertyChanged(nameof(ShowAutosaveRequiresPasswords));
            }

            SetTokenViewModel(tokenViewModelFactory);

            AdditionalAttachmentsViewModel = selectFilesUserControlViewModelFactory.Builder()
                                             .WithTitleGetter(() => Translation.MailAttachmentTitle)
                                             .WithFileListGetter(profile => profile.EmailSmtpSettings.AdditionalAttachments)
                                             .Build();

            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 AsyncCommand(TestSmtpExecute);
        }
Exemple #8
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();
        }
Exemple #9
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);
        }
Exemple #10
0
 public WorkflowTestPageSettingsViewModel(
     ICommandLocator commandLocator,
     ITranslationUpdater translationUpdater) : base(translationUpdater)
 {
     PrintPdfCreatorTestPageCommand = commandLocator
                                      .CreateMacroCommand()
                                      .AddCommand <AskForSavingCommand>()
                                      .AddCommand <ISaveChangedSettingsCommand>()
                                      .AddCommand <IPrintTestPageAsyncCommand>()
                                      .Build();
 }
Exemple #11
0
        public SmtpActionViewModel(IInteractionRequest interactionRequest,
                                   ISmtpTest smtpTest,
                                   ITranslationUpdater updater,
                                   ICurrentSettingsProvider currentSettingsProvider,
                                   ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                   ICommandLocator commandLocator,
                                   ITokenViewModelFactory tokenViewModelFactory,
                                   IDispatcher dispatcher,
                                   IGpoSettings gpoSettings,
                                   IOpenFileInteractionHelper openFileInteractionHelper)
            : base(updater, currentSettingsProvider, dispatcher, openFileInteractionHelper)
        {
            _interactionRequest = interactionRequest;
            _smtpTest           = smtpTest;
            _accountsProvider   = accountsProvider;
            _commandLocator     = commandLocator;
            _gpoSettings        = gpoSettings;

            _smtpAccounts = _accountsProvider?.Settings.SmtpAccounts;

            if (_smtpAccounts != null)
            {
                SmtpAccountsView = new ListCollectionView(_smtpAccounts);
                SmtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(SmtpAccount.AccountInfo), ListSortDirection.Ascending));
            }

            SetTokenViewModel(tokenViewModelFactory);

            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 AsyncCommand(TestSmtpExecute);
        }
Exemple #12
0
        public MainShellViewModel(DragAndDropEventHandler dragAndDrop, ITranslationUpdater translation,
                                  ApplicationNameProvider applicationName, IInteractionRequest interactionRequest,
                                  IEventAggregator aggregator, ICommandLocator commandLocator, IDispatcher dispatcher, IRegionManager regionManager,
                                  IWelcomeSettingsHelper welcomeSettingsHelper, IGpoSettings gpoSettings, IUpdateAssistant updateAssistant, IEventAggregator eventAggregator)
            : base(translation)
        {
            _aggregator        = aggregator;
            ApplicationName    = applicationName;
            InteractionRequest = interactionRequest;

            _dispatcher            = dispatcher;
            _regionManager         = regionManager;
            _welcomeSettingsHelper = welcomeSettingsHelper;
            ShowUpdate             = updateAssistant.IsUpdateAvailable();
            GpoSettings            = gpoSettings;

            NavigateCommand = commandLocator?.CreateMacroCommand()
                              .AddCommand <EvaluateSettingsAndNotifyUserCommand>()
                              .AddCommand <SaveChangedSettingsCommand>()
                              .AddCommand <NavigateToMainTabCommand>()
                              .Build();

            CloseCommand = commandLocator?.CreateMacroCommand()
                           .AddCommand <EvaluateSettingsAndNotifyUserCommand>()
                           .AddCommand <SaveChangedSettingsCommand>()
                           .Build();

            DragEnterCommand = new DelegateCommand <DragEventArgs>(dragAndDrop.HandleDragEnter);
            DragDropCommand  = new DelegateCommand <DragEventArgs>(dragAndDrop.HandleDropEvent);

            aggregator.GetEvent <NavigateToHomeEvent>().Subscribe(OnSettingsChanged);
            aggregator.GetEvent <NavigateMainTabEvent>().Subscribe(OnMainShellNavigated);
            aggregator.GetEvent <ForceMainShellNavigation>().Subscribe(OnForcedNavigation);
            aggregator.GetEvent <CloseMainWindowEvent>().Subscribe(OnCloseMainWindow);

            ShowUpdate = updateAssistant.ShowUpdate;
            eventAggregator.GetEvent <SetShowUpdateEvent>().Subscribe(value =>
            {
                ShowUpdate = updateAssistant.ShowUpdate;
            }, true);
        }
Exemple #13
0
        public DropboxUserControlViewModel(ITranslationUpdater translationUpdater, ICurrentSettingsProvider currentSettingsProvider, ICommandLocator commandLocator, ITokenViewModelFactory tokenViewModelFactory, IDispatcher dispatcher)
            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            AddDropboxAccountCommand = commandLocator.CreateMacroCommand()
                                       .AddCommand <DropboxAccountAddCommand>()
                                       .AddCommand(new DelegateCommand(SelectNewAccountInView))
                                       .Build();

            DropboxAccounts = currentSettingsProvider?.Settings?.ApplicationSettings.Accounts.DropboxAccounts;

            translationUpdater.RegisterAndSetTranslation(tf => SetTokenViewModels(tokenViewModelFactory));
        }
        public FtpActionViewModel(ITranslationUpdater translationUpdater,
                                  ICurrentSettings <Conversion.Settings.Accounts> accountsProvider,
                                  ICurrentSettingsProvider currentSettingsProvider,
                                  ICommandLocator commandLocator,
                                  ITokenViewModelFactory tokenViewModelFactory,
                                  IDispatcher dispatcher,
                                  IGpoSettings gpoSettings)

            : base(translationUpdater, currentSettingsProvider, dispatcher)
        {
            _accountsProvider      = accountsProvider;
            _commandLocator        = commandLocator;
            _tokenViewModelFactory = tokenViewModelFactory;
            _gpoSettings           = gpoSettings;

            _ftpAccounts = _accountsProvider?.Settings.FtpAccounts;

            if (_ftpAccounts != null)
            {
                FtpAccountsView = new ListCollectionView(_ftpAccounts);
                FtpAccountsView.SortDescriptions.Add(new SortDescription(nameof(FtpAccount.AccountInfo), ListSortDirection.Ascending));
                FtpAccountsView.CurrentChanged += (sender, args) => RaisePropertyChanged(nameof(ShowAutosaveRequiresPasswords));
            }

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

            EditAccountCommand = _commandLocator.CreateMacroCommand()
                                 .AddCommand <FtpAccountEditCommand>()
                                 .AddCommand(new DelegateCommand(o => RefreshAccountsView()))
                                 .Build();

            DirectoryTokenViewModel = _tokenViewModelFactory
                                      .BuilderWithSelectedProfile()
                                      .WithSelector(p => p.Ftp.Directory)
                                      .WithDefaultTokenReplacerPreview(th => th.GetTokenListWithFormatting())
                                      .Build();
        }
        public LicenseExpirationReminderViewModel(ILicenseExpirationReminder licenseExpirationReminder, ICommandLocator commandLocator,
                                                  ITranslationUpdater translationUpdater, IWebLinkLauncher webLinkLauncher) : base(translationUpdater)
        {
            _licenseExpirationReminder = licenseExpirationReminder;
            _webLinkLauncher           = webLinkLauncher;

            ManageLicensesCommand = commandLocator?.CreateMacroCommand()
                                    .AddCommand(new DelegateCommand(_ => ManageLicensesCommandExecute()))
                                    .AddCommand(new DelegateCommand(_ => SetReminderForLicenseExpiration()))
                                    .Build();

            ShowLicenseExpireReminder = _licenseExpirationReminder.IsExpirationReminderDue();

            RemindMeLaterCommand = new DelegateCommand(o => SetReminderForLicenseExpiration());
        }
Exemple #16
0
 private void SetupEditProfileCommand(ICommandLocator commandsLocator, IEventAggregator eventAggregator)
 {
     if (commandsLocator != null)
     {
         EditProfileCommand = commandsLocator.CreateMacroCommand()
                              .AddCommand(new DelegateCommand(SetProfileForSelection))
                              .AddCommand <ShowLockLayerCommand>()
                              .AddCommand <OpenProfileCommand>()
                              .AddCommand <WaitProfileModificationCommand>()
                              .AddCommand(new DelegateCommand(x => eventAggregator.GetEvent <CloseMainWindowEvent>().Publish()))
                              .AddCommand(new DelegateCommand(UpdateJobProfileFromCurrentProperties))
                              .AddCommand <HideLockLayerCommand>()
                              .Build();
     }
 }
Exemple #17
0
        public HomeViewModel(IInteractionInvoker interactionInvoker, IFileConversionAssistant fileConversionAssistant, ITranslationUpdater translationUpdater,
                             IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IJobHistoryActiveRecord jobHistoryActiveRecord, IDispatcher dispatcher,
                             ICommandLocator commandLocator, IGpoSettings gpoSettings)
            : base(translationUpdater)
        {
            _interactionInvoker      = interactionInvoker;
            _fileConversionAssistant = fileConversionAssistant;
            _printerHelper           = printerHelper;
            _settingsProvider        = settingsProvider;
            _jobHistoryActiveRecord  = jobHistoryActiveRecord;
            _dispatcher     = dispatcher;
            _commandLocator = commandLocator;
            _gpoSettings    = gpoSettings;

            _jobHistoryList = new ObservableCollection <HistoricJob>();

            var viewSource = new CollectionViewSource();

            viewSource.SortDescriptions.Add(new SortDescription(nameof(HistoricJob.CreationTime), ListSortDirection.Descending));
            viewSource.Source = _jobHistoryList;

            JobHistory = viewSource.View;
            JobHistory.MoveCurrentTo(null); //unselect first item

            ConvertFileCommand = new DelegateCommand(o => ConvertFileExecute());

            ClearHistoryCommand         = new DelegateCommand(o => jobHistoryActiveRecord.Delete());
            RefreshHistoryCommand       = new DelegateCommand(o => RefreshHistory());
            ToggleHistoryEnabledCommand = new DelegateCommand <HistoricJob>(hj => HistoryEnabled = !HistoryEnabled);

            RemoveHistoricJobCommand = new DelegateCommand <HistoricJob>(jobHistoryActiveRecord.Remove);

            DeleteHistoricFilesCommand = commandLocator.CreateMacroCommand()
                                         .AddCommand <DeleteHistoricFilesCommand>()
                                         .AddCommand(new AsyncCommand(o => _jobHistoryActiveRecord.Refresh()))
                                         .Build();

            QuickActionOpenList = new List <DropDownButtonItem>
            {
                GetQuickActionItem <QuickActionOpenWithPdfArchitectCommand>(() => Translation.OpenPDFArchitect),
                GetQuickActionItem <QuickActionOpenWithDefaultCommand>(() => Translation.OpenDefaultProgram),
                GetQuickActionItem <QuickActionOpenExplorerLocationCommand>(() => Translation.OpenExplorer),
                GetQuickActionItem <QuickActionPrintWithPdfArchitectCommand>(() => Translation.PrintWithPDFArchitect),
                GetQuickActionItem <QuickActionOpenMailClientCommand>(() => Translation.OpenMailClient)
            };
        }
Exemple #18
0
        public HomeViewModel(IInteractionInvoker interactionInvoker, IFileConversionAssistant fileConversionAssistant, ITranslationUpdater translationUpdater,
                             IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IJobHistoryManager jobHistoryManager, IDispatcher dispatcher,
                             ICommandLocator commandLocator)
            : base(translationUpdater)
        {
            _interactionInvoker      = interactionInvoker;
            _fileConversionAssistant = fileConversionAssistant;
            _printerHelper           = printerHelper;
            _settingsProvider        = settingsProvider;
            _commandLocator          = commandLocator;

            JobHistory = CollectionViewSource.GetDefaultView(jobHistoryManager.History);
            jobHistoryManager.HistoryChanged += (sender, args) =>
            {
                dispatcher.BeginInvoke(JobHistory.Refresh);
                RaisePropertyChanged(nameof(NumberOfHistoricJobs));
            };
            JobHistory.MoveCurrentTo(null); //unselect first item

            ConvertFileCommand = new DelegateCommand(o => ConvertFileExecute());

            ClearHistoryCommand         = new DelegateCommand(o => jobHistoryManager.Clear());
            RefreshHistoryCommand       = new DelegateCommand(o => jobHistoryManager.Refresh());
            RemoveHistoricJobCommand    = new DelegateCommand <HistoricJob>(jobHistoryManager.Remove);
            ToggleHistoryEnabledCommand = new DelegateCommand <HistoricJob>(hj => HistoryEnabled = !HistoryEnabled);

            DeleteHistoricFilesCommand = commandLocator.CreateMacroCommand()
                                         .AddCommand <DeleteHistoricFilesCommand>()
                                         .AddCommand(RefreshHistoryCommand)
                                         .Build();

            StartQuickActionCommand = new DelegateCommand(StartQuickActionCommandExecute);

            QuickActionOpenList = new List <QuickActionListItemVo>
            {
                GetQuickActionItem <QuickActionOpenWithPdfArchitectCommand>(Translation.OpenPDFArchitect),
                GetQuickActionItem <QuickActionOpenWithDefaultCommand>(Translation.OpenDefaultProgram),
                GetQuickActionItem <QuickActionOpenExplorerLocationCommand>(Translation.OpenExplorer),
                GetQuickActionItem <QuickActionPrintWithPdfArchitectCommand>(Translation.PrintWithPDFArchitect),
                GetQuickActionItem <QuickActionOpenMailClientCommand>(Translation.OpenMailClient)
            };
        }
Exemple #19
0
        private void SetupEditProfileCommand(ICommandLocator commandsLocator, IEventAggregator eventAggregator)
        {
            eventAggregator.GetEvent <EditSettingsFinishedEvent>().Subscribe(p =>
            {
                if (SelectedProfile != p)
                {
                    SelectedProfile = p;
                    SetSelectedProfile(this, null);
                }
            });

            if (commandsLocator != null)
            {
                EditProfileCommand = commandsLocator.CreateMacroCommand()
                                     .AddCommand(new DelegateCommand(SetProfileForSelection))
                                     .AddCommand <ShowLockLayerCommand>()
                                     .AddCommand <OpenProfileCommand>()
                                     .AddCommand <WaitProfileModificationCommand>()
                                     .AddCommand(new DelegateCommand(x => eventAggregator.GetEvent <CloseMainWindowEvent>().Publish()))
                                     .AddCommand <HideLockLayerCommand>()
                                     .Build();
            }
        }
        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();
        }
        public void SetUp()
        {
            _accounts             = new Accounts();
            _accounts.FtpAccounts = new ObservableCollection <FtpAccount>();
            _accounts.FtpAccounts.Add(new FtpAccount());
            _accounts.SmtpAccounts = new ObservableCollection <SmtpAccount>();
            _accounts.SmtpAccounts.Add(new SmtpAccount());
            _accounts.HttpAccounts = new ObservableCollection <HttpAccount>();
            _accounts.HttpAccounts.Add(new HttpAccount());
            _accounts.DropboxAccounts = new ObservableCollection <DropboxAccount>();
            _accounts.DropboxAccounts.Add(new DropboxAccount());
            _accounts.TimeServerAccounts = new ObservableCollection <TimeServerAccount>();
            _accounts.TimeServerAccounts.Add(new TimeServerAccount());

            _commandLocator = Substitute.For <ICommandLocator>();
            _commandLocator.CreateMacroCommand().Returns(x => new MacroCommandBuilder(_commandLocator));

            _ftpAccountAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <FtpAccountAddCommand>().Returns(_ftpAccountAddCommand);

            _ftpAccountEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <FtpAccountEditCommand>().Returns(_ftpAccountEditCommand);

            _ftpAccountRemoveCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <FtpAccountRemoveCommand>().Returns(_ftpAccountRemoveCommand);

            _smtpAccountAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <SmtpAccountAddCommand>().Returns(_smtpAccountAddCommand);

            _smtpAccountEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <SmtpAccountEditCommand>().Returns(_smtpAccountEditCommand);

            _smtpAccountRemoveCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <SmtpAccountRemoveCommand>().Returns(_smtpAccountRemoveCommand);

            _httpAccountAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <HttpAccountAddCommand>().Returns(_httpAccountAddCommand);

            _httpAccountEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <HttpAccountEditCommand>().Returns(_httpAccountEditCommand);

            _httpAccountRemoveCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <HttpAccountRemoveCommand>().Returns(_httpAccountRemoveCommand);

            _dropboxAccountAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <DropboxAccountAddCommand>().Returns(_dropboxAccountAddCommand);

            _dropboxAccountRemoveCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <DropboxAccountRemoveCommand>().Returns(_dropboxAccountRemoveCommand);

            _timeServerAccountAddCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountAddCommand>().Returns(_timeServerAccountAddCommand);

            _timeServerAccountEditCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountEditCommand>().Returns(_timeServerAccountEditCommand);

            _timeServerAccountRemoveCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <TimeServerAccountRemoveCommand>().Returns(_timeServerAccountRemoveCommand);

            _saveApplicationSettingsChangesCommand = Substitute.For <ICommand>();
            _commandLocator.GetCommand <SaveChangedSettingsCommand>().Returns(_saveApplicationSettingsChangesCommand);

            InitViewModel();
        }