Exemplo n.º 1
0
        public void Setup()
        {
            _commandLocator        = Substitute.For <ICommandLocator>();
            _gpoSettings           = Substitute.For <IGpoSettings>();
            _welcomeSettingsHelper = Substitute.For <IWelcomeSettingsHelper>();
            _rssService            = Substitute.For <IRssService>();

            var settings = new PdfCreatorSettings();

            settings.ApplicationSettings.RssFeed = new pdfforge.PDFCreator.Conversion.Settings.RssFeed {
                Enable = true
            };

            _rssFeedSettingsProvider = Substitute.For <ICurrentSettings <pdfforge.PDFCreator.Conversion.Settings.RssFeed> >();
            _rssFeedSettingsProvider.Settings.Returns(settings.ApplicationSettings.RssFeed);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public RssFeedViewModel(ICommandLocator commandLocator, ICurrentSettings <Conversion.Settings.RssFeed> rssFeedSettingsProvider,
                                IGpoSettings gpoSettings, ITranslationUpdater translationUpdater,
                                IWelcomeSettingsHelper welcomeSettingsHelper, IRssService rssService,
                                IFileCacheFactory fileCacheFactory, ITempFolderProvider tempFolderProvider)
            : base(translationUpdater)
        {
            _rssFeedSettingsProvider = rssFeedSettingsProvider;
            _gpoSettings             = gpoSettings;
            _rssService         = rssService;
            _fileCacheFactory   = fileCacheFactory;
            _tempFolderProvider = tempFolderProvider;

            _feedItems = new List <FeedItem>();
            _fileCache = GetFileCache();

            ShowWelcome = welcomeSettingsHelper.CheckIfRequiredAndSetCurrentVersion(); //Because the CheckIfRequiredAndSetCurrentVersion() sets the version in the registry,
            RaisePropertyChanged(nameof(ShowWelcome));                                 // ShowWelcome has to be set here in the ctor and not directly in the property

            UrlOpenCommand = commandLocator.GetCommand <UrlOpenCommand>();

            ShowRssFeedCommand = new DelegateCommand(ShowRssFeed);

            ShowWelcomeWindow();
        }