Exemplo n.º 1
0
 public void SetUp()
 {
     userPreferences = Substitute.For <IUserPreferences>();
     timer           = Substitute.For <ITimer>();
     eventHub        = new FakeEventHub();
     engine          = new PomodoroEngine(timer, userPreferences, eventHub);
 }
        public UpcomingEventsNotificationSettingsViewModel(
            IMvxNavigationService navigationService,
            IUserPreferences userPreferences,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.rxActionFactory   = rxActionFactory;

            this.AvailableOptions = new List <CalendarNotificationsOption>
            {
                CalendarNotificationsOption.Disabled,
                CalendarNotificationsOption.WhenEventStarts,
                CalendarNotificationsOption.FiveMinutes,
                CalendarNotificationsOption.TenMinutes,
                CalendarNotificationsOption.FifteenMinutes,
                CalendarNotificationsOption.ThirtyMinutes,
                CalendarNotificationsOption.OneHour
            };

            SelectOption = rxActionFactory.FromAction <CalendarNotificationsOption>(onSelectOption);
            Close        = rxActionFactory.FromAsync(() => navigationService.Close(this, Unit.Default));
        }
Exemplo n.º 3
0
 public IList <Project> GetProjectsFilteredByUserPreferences(IUserPreferences userPreferences, User user)
 {
     //if (userPreferences.ShowAllTasks)
     //    return GetAll(false);
     //else
     return(user.Projects);
 }
Exemplo n.º 4
0
 public UserPreferences()
 {
     InitializeComponent();
     preferences = new Api.IO.UserPreferences();
     FxCopBinaryLocationTextBox.Text = preferences.FxCopPath;
     MsBuildLocationTextBox.Text     = preferences.MsBuildPath;
 }
Exemplo n.º 5
0
 public ValidBonusService(IWSValidBonoRepository wSValidBonoRepository, IMapperDependency mapperDependency, IUserPreferences userPreferences, IBonusDataRepository bonusDataRepository)
 {
     _wSValidBonoRepository = wSValidBonoRepository;
     _mapper              = mapperDependency.GetMapper();
     _userPreferences     = userPreferences;
     _bonusDataRepository = bonusDataRepository;
 }
Exemplo n.º 6
0
        public NotificationSettingsViewModel(
            IMvxNavigationService navigationService,
            IBackgroundService backgroundService,
            IPermissionsService permissionsService,
            IUserPreferences userPreferences)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(permissionsService, nameof(permissionsService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));

            this.navigationService  = navigationService;
            this.backgroundService  = backgroundService;
            this.permissionsService = permissionsService;
            this.userPreferences    = userPreferences;

            backgroundService
            .AppResumedFromBackground
            .SelectUnit()
            .Subscribe(refreshPermissionGranted)
            .DisposedBy(disposeBag);

            RequestAccessAction = new UIAction(requestAccess);
            OpenUpcomingEvents  = new UIAction(openUpcomingEvents);
        }
Exemplo n.º 7
0
        public IOCLocator(ISQLiteConnectionDependency sqliiteConnectionDependency, IMapperDependency mapperDependency,
                          INetworkDependency networkDependency, IUserPreferences userPreferences,
                          ICUCService cucService, ILoginService logService, IValidBonusService validBonusService,
                          IBonusDataRepository bonusDataRepository, ITokenDataRepository tokenDataRepository,
                          IUserDataRepository userDataRepository, IWSLoginRepository wsLoginRepository,
                          IWSValidBonoRepository wsValidBonoRepository)
        {
            SQLiteConnectionDependency = sqliiteConnectionDependency;
            MapperDependency           = mapperDependency;
            NetworkDependency          = networkDependency;
            UserPreferences            = userPreferences;


            CUCService        = cucService;
            LogService        = logService;
            ValidBonusService = validBonusService;


            BonusDataRepository = bonusDataRepository;
            TokenDataRepository = tokenDataRepository;
            UserDataRepository  = userDataRepository;


            WSLoginRepository     = wsLoginRepository;
            WSValidBonoRepository = wsValidBonoRepository;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns a <see cref="Brush"/> instance to use as a background for
        /// each entry on the <see cref="DocumentMetadata"/> list
        /// </summary>
        /// <param name="id">
        /// A value to be associated with a <see cref="Brush"/>. When
        /// <see cref="IUserPreferences.AssignProjectColours"/> is true,
        /// passing the same id on subsequent invocations of this method will
        /// return the same <see cref="Brush"/>
        /// </param>
        /// <param name="userPreferences">
        /// Determines whether the returned <see cref="Brush"/> is
        /// project-specific, generic, or transparent
        /// </param>
        /// <returns>
        /// A <see cref="Brush"/> appropriate to both <see cref="id"/> and the
        /// property values of <see cref="userPreferences"/>
        /// </returns>
        public Brush GetBrush(string id, IUserPreferences userPreferences)
        {
            Brush returnBrush;

            if (userPreferences.AssignProjectColours)
            {
                var entryExists = _brushAssignment.ContainsKey(id);

                if (!entryExists)
                {
                    var index =
                        _brushAssignment.Count %
                        _projectBrushes.ProjectSpecificBrushes.Length;

                    _brushAssignment[id] = _projectBrushes
                                           .ProjectSpecificBrushes[index];
                }

                returnBrush = _brushAssignment[id];
            }
            else
            {
                returnBrush = userPreferences.ShowRecentUsage
                    ? _projectBrushes.GenericBrush
                    : Brushes.Transparent;
            }

            return(returnBrush);
        }
Exemplo n.º 9
0
        public SendFeedbackInteractor(
            IFeedbackApi feedbackApi,
            ISingletonDataSource <IThreadSafeUser> userDataSource,
            IDataSource <IThreadSafeWorkspace, IDatabaseWorkspace> workspacesDataSource,
            IDataSource <IThreadSafeTimeEntry, IDatabaseTimeEntry> timeEntriesDataSource,
            IPlatformInfo platformInfo,
            IUserPreferences userPreferences,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            string message)
        {
            Ensure.Argument.IsNotNull(message, nameof(message));
            Ensure.Argument.IsNotNull(feedbackApi, nameof(feedbackApi));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(userDataSource, nameof(userDataSource));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(workspacesDataSource, nameof(workspacesDataSource));
            Ensure.Argument.IsNotNull(timeEntriesDataSource, nameof(timeEntriesDataSource));

            this.message               = message;
            this.feedbackApi           = feedbackApi;
            this.timeService           = timeService;
            this.platformInfo          = platformInfo;
            this.userDataSource        = userDataSource;
            this.userPreferences       = userPreferences;
            this.workspacesDataSource  = workspacesDataSource;
            this.timeEntriesDataSource = timeEntriesDataSource;
            this.lastTimeUsageStorage  = lastTimeUsageStorage;
        }
        public InteractorFactory(
            IIdProvider idProvider,
            ITogglDatabase database,
            ITimeService timeService,
            ITogglDataSource dataSource,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IApplicationShortcutCreator shortcutCreator)
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(idProvider, nameof(idProvider));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.database         = database;
            this.dataSource       = dataSource;
            this.idProvider       = idProvider;
            this.timeService      = timeService;
            this.userPreferences  = userPreferences;
            this.shortcutCreator  = shortcutCreator;
            this.analyticsService = analyticsService;
        }
Exemplo n.º 11
0
        public TokenResetViewModel(
            ILoginManager loginManager,
            ITogglDataSource dataSource,
            IDialogService dialogService,
            IForkingNavigationService navigationService,
            IUserPreferences userPreferences,
            IOnboardingStorage onboardingStorage,
            IAnalyticsService analyticsService
            )
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(loginManager, nameof(loginManager));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.dataSource        = dataSource;
            this.loginManager      = loginManager;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.onboardingStorage = onboardingStorage;
            this.analyticsService  = analyticsService;

            DoneCommand    = new MvxCommand(done);
            SignOutCommand = new MvxAsyncCommand(signout);
            TogglePasswordVisibilityCommand = new MvxCommand(togglePasswordVisibility);
        }
        public NotificationSettingsViewModel(
            INavigationService navigationService,
            IBackgroundService backgroundService,
            IPermissionsChecker permissionsChecker,
            IUserPreferences userPreferences,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            PermissionGranted = backgroundService.AppResumedFromBackground
                                .SelectUnit()
                                .StartWith(Unit.Default)
                                .SelectMany(_ => permissionsChecker.NotificationPermissionGranted)
                                .DistinctUntilChanged()
                                .AsDriver(schedulerProvider);

            UpcomingEvents = userPreferences.CalendarNotificationsSettings()
                             .Select(s => s.Title())
                             .DistinctUntilChanged()
                             .AsDriver(schedulerProvider);

            RequestAccess      = rxActionFactory.FromAction(requestAccess);
            OpenUpcomingEvents = rxActionFactory.FromAsync(openUpcomingEvents);
        }
        public InteractorFactory(
            IIdProvider idProvider,
            ITimeService timeService,
            ITogglDataSource dataSource,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IApplicationShortcutCreator shortcutCreator,
            ILastTimeUsageStorage lastTimeUsageStorage,
            IPlatformConstants platformConstants,
            UserAgent userAgent)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(idProvider, nameof(idProvider));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants));
            Ensure.Argument.IsNotNull(userAgent, nameof(userAgent));

            this.dataSource           = dataSource;
            this.idProvider           = idProvider;
            this.timeService          = timeService;
            this.userPreferences      = userPreferences;
            this.shortcutCreator      = shortcutCreator;
            this.analyticsService     = analyticsService;
            this.lastTimeUsageStorage = lastTimeUsageStorage;
            this.platformConstants    = platformConstants;
            this.userAgent            = userAgent;
        }
Exemplo n.º 14
0
 public ApiClient(string baseUrl, INetworkDependency networkDependency, IUserPreferences userPreferences)
 {
     this.BaseUrl         = baseUrl;
     this.UserPreferences = userPreferences;
     _client            = CreateClient();
     _networkDependency = networkDependency;
 }
Exemplo n.º 15
0
        public LogoutInteractor(
            IAnalyticsService analyticsService,
            INotificationService notificationService,
            IApplicationShortcutCreator shortcutCreator,
            ISyncManager syncManager,
            ITogglDatabase database,
            IUserPreferences userPreferences,
            IPrivateSharedStorageService privateSharedStorageService,
            IUserAccessManager userAccessManager,
            LogoutSource source)
        {
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsADefinedEnumValue(source, nameof(source));

            this.analyticsService            = analyticsService;
            this.shortcutCreator             = shortcutCreator;
            this.notificationService         = notificationService;
            this.syncManager                 = syncManager;
            this.database                    = database;
            this.userPreferences             = userPreferences;
            this.privateSharedStorageService = privateSharedStorageService;
            this.userAccessManager           = userAccessManager;
            this.source = source;
        }
        protected SelectUserCalendarsViewModelBase(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory,
            IOnboardingStorage onboardingStorage,
            IAnalyticsService analyticsService,
            INavigationService navigationService,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            UserPreferences        = userPreferences;
            this.interactorFactory = interactorFactory;
            OnboardingStorage      = onboardingStorage;
            AnalyticsService       = analyticsService;

            Save           = rxActionFactory.FromAction(Done, doneEnabledSubject.AsObservable());
            SelectCalendar = rxActionFactory.FromAction <SelectableUserCalendarViewModel>(toggleCalendarSelection);

            Calendars = calendarsSubject.AsObservable().DistinctUntilChanged();
        }
        public UpcomingEventsNotificationSettingsViewModel(
            INavigationService navigationService,
            IUserPreferences userPreferences,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.rxActionFactory   = rxActionFactory;

            var options = new[] {
                CalendarNotificationsOption.Disabled,
                CalendarNotificationsOption.WhenEventStarts,
                CalendarNotificationsOption.FiveMinutes,
                CalendarNotificationsOption.TenMinutes,
                CalendarNotificationsOption.FifteenMinutes,
                CalendarNotificationsOption.ThirtyMinutes,
                CalendarNotificationsOption.OneHour
            };

            AvailableOptions = options.Select(toSelectableOption).ToList();

            SelectOption = rxActionFactory.FromAction <SelectableCalendarNotificationsOptionViewModel>(onSelectOption);
            Close        = rxActionFactory.FromAsync(close);
        }
Exemplo n.º 18
0
        public ViewModelService InitializeViewModelService(
            IAboutPanelService aboutPanelService             = null,
            IDialoguePageCommands dialoguePageCommands       = null,
            IDocumentMetadataManager documentMetadataManager = null,
            IOptionsLists optionsLists = null,
            IOptionsPageControlFactory optionsPageControlFactory = null,
            ISolutionEventsService solutionEventsService         = null,
            IToolWindowCommands toolWindowCommands = null,
            IUserPreferences userPreferences       = null,
            IUserPreferencesModelFactory userPreferencesModelFactory       = null,
            IUserPreferencesModelRepository userPreferencesModelRepository = null)
        {
            var repository = new MockRepository(MockBehavior.Loose)
            {
                DefaultValue = DefaultValue.Mock
            };

            var service = new ViewModelService(
                aboutPanelService ?? Mock.Of <IAboutPanelService>(),
                dialoguePageCommands ?? Mock.Of <IDialoguePageCommands>(),
                documentMetadataManager ?? Mock.Of <IDocumentMetadataManager>(),
                optionsLists ?? repository.OneOf <IOptionsLists>(),
                optionsPageControlFactory ?? repository.OneOf <IOptionsPageControlFactory>(),
                solutionEventsService ?? Mock.Of <ISolutionEventsService>(),
                toolWindowCommands ?? Mock.Of <IToolWindowCommands>(),
                userPreferences ?? Mock.Of <IUserPreferences>(),
                userPreferencesModelFactory ?? Mock.Of <IUserPreferencesModelFactory>(),
                userPreferencesModelRepository ?? Mock.Of <IUserPreferencesModelRepository>());

            return(service);
        }
Exemplo n.º 19
0
        public MainViewModel(
            IScheduler scheduler,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IUserPreferences userPreferences,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(scheduler, nameof(scheduler));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.scheduler         = scheduler;
            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.userPreferences   = userPreferences;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.onboardingStorage = onboardingStorage;

            RefreshCommand        = new MvxCommand(refresh);
            OpenReportsCommand    = new MvxAsyncCommand(openReports);
            OpenSettingsCommand   = new MvxAsyncCommand(openSettings);
            EditTimeEntryCommand  = new MvxAsyncCommand(editTimeEntry, () => CurrentTimeEntryId.HasValue);
            StopTimeEntryCommand  = new MvxAsyncCommand(stopTimeEntry, () => isStopButtonEnabled);
            StartTimeEntryCommand = new MvxAsyncCommand(startTimeEntry, () => CurrentTimeEntryId.HasValue == false);
        }
Exemplo n.º 20
0
 public LogServer(ILogWriter logWriter, IUsers usersSource, IUserPreferences userPreferences)
 {
     _logWriter       = logWriter;
     _usersSource     = usersSource;
     _userPreferences = userPreferences;
     ServerId         = $"SER_{DateTime.UtcNow.ToString()}_WER";
 }
        public DocumentMetadataManager(
            ICollectionViewGenerator collectionViewGenerator,
            IDocumentMetadataEqualityService metadataEqualityService,
            IDocumentMetadataFactory documentMetadataFactory,
            INormalizedUsageOrderService normalizedUsageOrderService,
            IProjectItemService projectItemService,
            ITimeProvider timeProvider,
            IUpdateReactionManager updateReactionManager,
            IUserPreferences userPreferences)
        {
            _activeDocumentMetadata  = new ObservableCollection <DocumentMetadata>();
            _collectionViewGenerator = collectionViewGenerator;

            ActiveDocumentMetadata = InitializeActiveDocumentMetadata();
            PinnedDocumentMetadata = InitializePinnedDocumentMetadata();

            _metadataEqualityService     = metadataEqualityService;
            _documentMetadataFactory     = documentMetadataFactory;
            _normalizedUsageOrderService = normalizedUsageOrderService;
            _projectItemService          = projectItemService;
            _timeProvider    = timeProvider;
            _userPreferences = userPreferences;

            updateReactionManager.Initialize(ActiveDocumentMetadata);
        }
Exemplo n.º 22
0
        public TokenResetViewModel(
            IUserAccessManager userAccessManager,
            ITogglDataSource dataSource,
            IDialogService dialogService,
            IMvxNavigationService navigationService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            IInteractorFactory interactorFactory
            )
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.dataSource        = dataSource;
            this.userAccessManager = userAccessManager;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;
            this.rxActionFactory   = rxActionFactory;
            this.interactorFactory = interactorFactory;

            Email = emailSubject
                    .DistinctUntilChanged()
                    .AsDriver(schedulerProvider);

            IsPasswordMasked = isPasswordMaskedSubject
                               .DistinctUntilChanged()
                               .AsDriver(schedulerProvider);

            TogglePasswordVisibility = rxActionFactory.FromAction(togglePasswordVisibility);

            Done    = rxActionFactory.FromObservable(done);
            SignOut = rxActionFactory.FromAsync(signout);

            Error = Done.Errors
                    .Select(transformException);

            HasError = Error
                       .Select(error => !string.IsNullOrEmpty(error))
                       .DistinctUntilChanged()
                       .AsDriver(schedulerProvider);

            NextIsEnabled = Password
                            .Select(Multivac.Password.From)
                            .CombineLatest(Done.Executing, (password, isExecuting) => password.IsValid && !isExecuting)
                            .DistinctUntilChanged()
                            .AsDriver(schedulerProvider);
        }
Exemplo n.º 23
0
        public static FoundationMvvmCross RegisterServices(this Foundation self,
                                                           IDialogService dialogService,
                                                           IBrowserService browserService,
                                                           IKeyValueStorage keyValueStorage,
                                                           IAccessRestrictionStorage accessRestrictionStorage,
                                                           IUserPreferences userPreferences,
                                                           IOnboardingStorage onboardingStorage,
                                                           IMvxNavigationService navigationService,
                                                           IPasswordManagerService passwordManagerService = null)
        {
            Ensure.Argument.IsNotNull(self, nameof(self));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));
            Ensure.Argument.IsNotNull(keyValueStorage, nameof(keyValueStorage));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            var timeService = self.TimeService;

            var apiErrorHandlingService = new ApiErrorHandlingService(navigationService, accessRestrictionStorage);

            Mvx.RegisterSingleton(self.BackgroundService);
            Mvx.RegisterSingleton(dialogService);
            Mvx.RegisterSingleton(self.Database);
            Mvx.RegisterSingleton(browserService);
            Mvx.RegisterSingleton(self.UserAgent);
            Mvx.RegisterSingleton(self.TimeService);
            Mvx.RegisterSingleton(self.Scheduler);
            Mvx.RegisterSingleton(self.ShortcutCreator);
            Mvx.RegisterSingleton(self.MailService);
            Mvx.RegisterSingleton(self.ShortcutCreator);
            Mvx.RegisterSingleton(self.AnalyticsService);
            Mvx.RegisterSingleton(self.PlatformConstants);
            Mvx.RegisterSingleton(self.Database.IdProvider);
            Mvx.RegisterSingleton(self.SuggestionProviderContainer);
            Mvx.RegisterSingleton(userPreferences);
            Mvx.RegisterSingleton(onboardingStorage);
            Mvx.RegisterSingleton(accessRestrictionStorage);
            Mvx.RegisterSingleton <IApiErrorHandlingService>(apiErrorHandlingService);
            Mvx.RegisterSingleton(passwordManagerService ?? new StubPasswordManagerService());

            Mvx.LazyConstructAndRegisterSingleton <IInteractorFactory, InteractorFactory>();

            return(new FoundationMvvmCross(
                       self.ApiFactory,
                       self.Database,
                       timeService,
                       self.Scheduler,
                       self.AnalyticsService,
                       self.GoogleService,
                       self.ShortcutCreator,
                       self.BackgroundService,
                       onboardingStorage,
                       accessRestrictionStorage,
                       navigationService,
                       apiErrorHandlingService));
        }
        public GetUserCalendarsInteractor(ICalendarService calendarService, IUserPreferences userPreferences)
        {
            Ensure.Argument.IsNotNull(calendarService, nameof(calendarService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));

            this.calendarService = calendarService;
            this.userPreferences = userPreferences;
        }
Exemplo n.º 25
0
        public PomodoroEngine(ITimer timer, IUserPreferences userPreferences, IEventHub eventHub)
        {
            this.timer           = timer;
            this.userPreferences = userPreferences;
            this.eventHub        = eventHub;

            eventHub.Subscribe <TimerStopped>(OnTimerStopped);
        }
        public SetEnabledCalendarsInteractor(IUserPreferences userPreferences, params string[] selectedCalendarIds)
        {
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(selectedCalendarIds, nameof(selectedCalendarIds));

            this.userPreferences     = userPreferences;
            this.selectedCalendarIds = selectedCalendarIds;
        }
 public NotificationsPresenter(IPomodoroEngine pomodoroEngine, IUserPreferences userPreferences, IEventHub eventHub)
 {
     this.pomodoroEngine  = pomodoroEngine;
     this.userPreferences = userPreferences;
     eventHub.Subscribe <TimerStopped>(OnTimerStopped);
     eventHub.Subscribe <AppUpdated>(OnAppUpdated);
     eventHub.Subscribe <FirstRun>(OnFirstRun);
 }
 public MockSelectUserCalendarsViewModel(
     IUserPreferences userPreferences,
     IInteractorFactory interactorFactory,
     INavigationService navigationService,
     IRxActionFactory rxActionFactory)
     : base(userPreferences, interactorFactory, navigationService, rxActionFactory)
 {
 }
Exemplo n.º 29
0
 public WalletController(IRepository <Transaction> transactionRepository,
                         ICryptoService cryptoService,
                         IUserPreferences userPreferences)
 {
     _transactionRepository = transactionRepository;
     _cryptoService         = cryptoService;
     _userPreferences       = userPreferences;
 }
        public void UpdateCollection(ICollectionView view, IUserPreferences userPreferences)
        {
            var collection = (IList <DocumentMetadata>)view.SourceCollection;

            _normalizedUsageOrderService.SetUsageOrder(
                collection,
                userPreferences);
        }
Exemplo n.º 31
0
 public SignInController(IAuthenticator authenticator, ISecurityTokenizer tokenizer, IUserInfo userInfo, IUserPreferences userPreferences, ICache cache, ISessionManager sessionManager, UserManager<BookshelfUser> userManager)
 {
     this._authenticator = authenticator;
     this._tokenizer = tokenizer;
     this._userInfo = userInfo;
     this._userPreferences = userPreferences;
     this._cache = cache;
     this._sessionManager = sessionManager;
     UserManager = userManager;
 }
 public static void Init(IUserPreferences userPreferences, IAppDelegate appDelegate, IRenderer renderer)
 {
     App.UserPreferences = userPreferences;
     App.IOSAppDelegate = appDelegate;
     App.StreamRenderer = renderer;
 }