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();
        }
Ejemplo n.º 2
0
        public TimeEntriesViewModel(ITogglDataSource dataSource,
                                    IInteractorFactory interactorFactory,
                                    IAnalyticsService analyticsService,
                                    ISchedulerProvider schedulerProvider,
                                    IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.dataSource        = dataSource;
            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;
            this.rxActionFactory   = rxActionFactory;

            TimeEntries = new ObservableGroupedOrderedCollection <TimeEntryViewModel>(
                indexKey: t => t.Id,
                orderingKey: t => t.StartTime,
                groupingKey: t => t.StartTime.LocalDateTime.Date,
                descending: true
                );

            DelayDeleteTimeEntry  = rxActionFactory.FromAction <TimeEntryViewModel>(delayDeleteTimeEntry);
            CancelDeleteTimeEntry = rxActionFactory.FromAction(cancelDeleteTimeEntry);

            ShouldShowUndo = showUndoSubject.AsObservable().AsDriver(schedulerProvider);
        }
Ejemplo n.º 3
0
        public SelectColorViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory, ISchedulerProvider schedulerProvider)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            // Public properties
            Hue        = hue.AsDriver(schedulerProvider);
            Saturation = saturation.AsDriver(schedulerProvider);
            Value      = value.AsDriver(schedulerProvider);

            Save          = rxActionFactory.FromAction(save);
            SetHue        = rxActionFactory.FromAction <float>(hue.OnNext);
            SetSaturation = rxActionFactory.FromAction <float>(saturation.OnNext);
            SetValue      = rxActionFactory.FromAction <float>(value.OnNext);
            SelectColor   = rxActionFactory.FromAction <Color>(selectColor);

            customColor = Observable.CombineLatest(hue, saturation, value, Colors.FromHSV)
                          .SkipUntil(startCustomColorEmitting)
                          .Throttle(TimeSpan.FromMilliseconds(100), schedulerProvider.DefaultScheduler)
                          .Do(selectedColor.OnNext);

            var firstCustomColor = Colors.FromHSV(hue.Value, saturation.Value, value.Value);

            var availableColors = Observable.Return(Colors.DefaultProjectColors)
                                  .CombineLatest(customColor.StartWith(firstCustomColor), combineAllColors);

            SelectableColors = availableColors
                               .CombineLatest(selectedColor, updateSelectableColors)
                               .Do(_ => startCustomColorEmitting.OnNext(Unit.Default));
        }
Ejemplo n.º 4
0
        public SelectColorViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.rxActionFactory = rxActionFactory;

            // Public properties
            Hue        = hue.AsObservable();
            Saturation = saturation.AsObservable();
            Value      = value.AsObservable();

            Save          = rxActionFactory.FromAction(save);
            SetHue        = rxActionFactory.FromAction <float>(hue.OnNext);
            SetSaturation = rxActionFactory.FromAction <float>(saturation.OnNext);
            SetValue      = rxActionFactory.FromAction <float>(value.OnNext);
            SelectColor   = rxActionFactory.FromAction <Color>(selectColor);

            customColor = Observable
                          .CombineLatest(hue, saturation, value, Colors.FromHSV)
                          .Do(selectedColor.OnNext);

            var availableColors = Observable.Return(Colors.DefaultProjectColors)
                                  .CombineLatest(customColor, combineAllColors);

            SelectableColors = availableColors
                               .CombineLatest(selectedColor, updateSelectableColors);
        }
Ejemplo n.º 5
0
        public OutdatedAppViewModel(IBrowserService browserService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.browserService  = browserService;
            this.rxActionFactory = rxActionFactory;

            UpdateApp   = rxActionFactory.FromAction(updateApp);
            OpenWebsite = rxActionFactory.FromAction(openWebsite);
        }
Ejemplo n.º 6
0
        public TermsOfServiceViewModel(IBrowserService browserService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.browserService  = browserService;
            this.rxActionFactory = rxActionFactory;

            ViewPrivacyPolicy  = rxActionFactory.FromAction(() => openUrl(privacyPolicyUrl));
            ViewTermsOfService = rxActionFactory.FromAction(() => openUrl(termsOfServiceUrl));
            Close = rxActionFactory.FromAsync <bool>(result => NavigationService.Close(this, result));
        }
Ejemplo n.º 7
0
        public TimeEntriesViewModel(
            ITogglDataSource dataSource,
            IInteractorFactory interactorFactory,
            IAnalyticsService analyticsService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            ITimeService timeService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));

            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;

            DelayDeleteTimeEntries = rxActionFactory.FromAction <long[]>(delayDeleteTimeEntries);
            ToggleGroupExpansion   = rxActionFactory.FromAction <GroupId>(toggleGroupExpansion);
            CancelDeleteTimeEntry  = rxActionFactory.FromAction(cancelDeleteTimeEntry);

            groupsFlatteningStrategy = new TimeEntriesGroupsFlattening(timeService);

            var deletingOrPressingUndo = timeEntriesPendingDeletionSubject.SelectUnit();
            var collapsingOrExpanding  = ToggleGroupExpansion.Elements;

            var visibleTimeEntries = interactorFactory.ObserveAllTimeEntriesVisibleToTheUser().Execute()
                                     .Select(timeEntries => timeEntries.Where(isNotRunning))
                                     .ReemitWhen(deletingOrPressingUndo)
                                     .Select(timeEntries => timeEntries.Where(isNotDeleted))
                                     .Select(group)
                                     .ReemitWhen(collapsingOrExpanding);

            TimeEntries = Observable.CombineLatest(
                visibleTimeEntries,
                dataSource.Preferences.Current,
                groupsFlatteningStrategy.Flatten)
                          .AsDriver(schedulerProvider);

            Empty = TimeEntries
                    .Select(groups => groups.None())
                    .AsDriver(schedulerProvider);

            Count = TimeEntries
                    .Select(log => log.Sum(day => day.Items.Count))
                    .AsDriver(schedulerProvider);

            TimeEntriesPendingDeletion = timeEntriesPendingDeletionSubject.AsObservable().AsDriver(schedulerProvider);
        }
Ejemplo n.º 8
0
        public SelectProjectViewModel(
            ITogglDataSource dataSource,
            IRxActionFactory rxActionFactory,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider,
            IStopwatchProvider stopwatchProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));

            this.dataSource        = dataSource;
            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.schedulerProvider = schedulerProvider;
            this.stopwatchProvider = stopwatchProvider;

            Close = rxActionFactory.FromAsync(close);
            ToggleTaskSuggestions = rxActionFactory.FromAction <ProjectSuggestion>(toggleTaskSuggestions);
            SelectProject         = rxActionFactory.FromAsync <AutocompleteSuggestion>(selectProject);

            IsEmpty         = dataSource.Projects.GetAll().Select(projects => projects.None());
            PlaceholderText = IsEmpty.Select(isEmpty => isEmpty ? Resources.EnterProject : Resources.AddFilterProjects);
        }
Ejemplo n.º 9
0
        public ForgotPasswordViewModel(
            ITimeService timeService,
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            IMvxNavigationService navigationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService       = timeService;
            this.userAccessManager = userAccessManager;
            this.analyticsService  = analyticsService;
            this.navigationService = navigationService;
            this.rxActionFactory   = rxActionFactory;

            Reset = rxActionFactory.FromObservable(reset, Email.Select(email => email.IsValid));
            Close = rxActionFactory.FromAction(returnEmail, Reset.Executing.Invert());

            ErrorMessage = Reset.Errors
                           .Select(toErrorString)
                           .StartWith("");

            PasswordResetSuccessful = Reset.Elements
                                      .Select(_ => true)
                                      .StartWith(false);
        }
Ejemplo n.º 10
0
        public SelectCountryViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            SelectCountry = rxActionFactory.FromAction<SelectableCountryViewModel>(selectCountry);
        }
        public ReportsCalendarViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            IRxActionFactory rxActionFactory,
            INavigationService navigationService,
            ISchedulerProvider schedulerProvider)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.schedulerProvider = schedulerProvider;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject
                                    .AsObservable()
                                    .DistinctUntilChanged();

            SelectedDateRangeObservable = selectedDateRangeSubject
                                          .ShareReplay(1);

            HighlightedDateRangeObservable = highlightedDateRangeSubject
                                             .ShareReplay(1);
        }
        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));
        }
Ejemplo n.º 13
0
        public ReportsCalendarViewModel(
            ITimeService timeService,
            IDialogService dialogService,
            ITogglDataSource dataSource,
            IIntentDonationService intentDonationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService           = timeService;
            this.dialogService         = dialogService;
            this.dataSource            = dataSource;
            this.intentDonationService = intentDonationService;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject.AsObservable();

            SelectedDateRangeObservable = selectedDateRangeSubject
                                          .ShareReplay(1);

            HighlightedDateRangeObservable = highlightedDateRangeSubject
                                             .ShareReplay(1);
        }
Ejemplo n.º 14
0
        public ReportsCalendarViewModel(
            ITimeService timeService,
            IDialogService dialogService,
            ITogglDataSource dataSource,
            IIntentDonationService intentDonationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService           = timeService;
            this.dialogService         = dialogService;
            this.dataSource            = dataSource;
            this.intentDonationService = intentDonationService;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject
                                    .StartWith(MonthsToShow - 1)
                                    .DistinctUntilChanged();
        }
        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);
        }
Ejemplo n.º 16
0
        public SendFeedbackViewModel(
            INavigationService navigationService,
            IInteractorFactory interactorFactory,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;

            IsFeedbackEmpty = isEmptyObservable.DistinctUntilChanged().AsDriver(schedulerProvider);
            SendEnabled     = sendingIsEnabledObservable.DistinctUntilChanged().AsDriver(schedulerProvider);

            Close        = rxActionFactory.FromObservable(cancel);
            DismissError = rxActionFactory.FromAction(dismissError);
            Send         = rxActionFactory.FromObservable(sendFeedback, sendingIsEnabledObservable);

            IsLoading = isLoadingSubject.AsDriver(false, schedulerProvider);
            Error     = currentErrorSubject.AsDriver(default(Exception), schedulerProvider);
        }
        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);
        }
Ejemplo n.º 18
0
        public SelectDateTimeViewModel(IRxActionFactory rxActionFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            Save = rxActionFactory.FromAction(save);
        }
Ejemplo n.º 19
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);
        }
        public CalendarPermissionDeniedViewModel(INavigationService navigationService, IPermissionsChecker permissionsChecker, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.permissionsChecker = permissionsChecker;

            EnableAccess = rxActionFactory.FromAction(enableAccess);
        }
Ejemplo n.º 21
0
        public CalendarPermissionDeniedViewModel(IPermissionsService permissionsService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(permissionsService, nameof(permissionsService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.permissionsService = permissionsService;

            EnableAccess = rxActionFactory.FromAction(enableAccess);
            Close        = rxActionFactory.FromAsync(() => NavigationService.Close(this, Unit.Default));
        }
Ejemplo n.º 22
0
        public SelectDateFormatViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            SelectDateFormat = rxActionFactory.FromAction <SelectableDateFormatViewModel>(selectFormat);

            DateTimeFormats = availableDateFormats
                              .Select(dateFormat => new SelectableDateFormatViewModel(dateFormat, false))
                              .ToImmutableList();
        }
Ejemplo n.º 23
0
        public SelectBeginningOfWeekViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            SelectBeginningOfWeek = rxActionFactory.FromAction <SelectableBeginningOfWeekViewModel>(selectFormat);

            BeginningOfWeekCollection = Enum.GetValues(typeof(BeginningOfWeek))
                                        .Cast <BeginningOfWeek>()
                                        .Select(beginningOfWeek => new SelectableBeginningOfWeekViewModel(beginningOfWeek, false))
                                        .ToArray();
        }
        public CalendarPermissionDeniedViewModel(IMvxNavigationService navigationService, IPermissionsService permissionsService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(permissionsService, nameof(permissionsService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService  = navigationService;
            this.permissionsService = permissionsService;

            EnableAccess = rxActionFactory.FromAction(enableAccess);
            Close        = rxActionFactory.FromAsync(close);
        }
        public PasteFromClipboardViewModel(
            IRxActionFactory rxActionFactory,
            IOnboardingStorage onboardingStorage,
            INavigationService navigationService) : base(navigationService)
        {
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.onboardingStorage = onboardingStorage;

            DoNotShowAgain = rxActionFactory.FromAction(doNotShowAgain);
        }
Ejemplo n.º 26
0
        public SelectWorkspaceViewModel(
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.interactorFactory = interactorFactory;

            SelectWorkspace = rxActionFactory.FromAction <SelectableWorkspaceViewModel>(selectWorkspace);
        }
Ejemplo n.º 27
0
        protected SelectUserCalendarsViewModelBase(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.userPreferences   = userPreferences;
            this.interactorFactory = interactorFactory;

            SelectCalendar = rxActionFactory.FromAction <SelectableUserCalendarViewModel>(toggleCalendarSelection);
        }
        public SelectDurationFormatViewModel(
            INavigationService navigationService,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            SelectDurationFormat = rxActionFactory.FromAction <SelectableDurationFormatViewModel>(selectFormat);

            DurationFormats = Enum.GetValues(typeof(DurationFormat))
                              .Cast <DurationFormat>()
                              .Select(durationFormat => new SelectableDurationFormatViewModel(durationFormat, false))
                              .ToImmutableList();
        }
Ejemplo n.º 29
0
        public SelectTagsViewModel(
            INavigationService navigationService,
            IInteractorFactory interactorFactory,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.interactorFactory = interactorFactory;
            this.schedulerProvider = schedulerProvider;

            Save      = rxActionFactory.FromAction(save);
            SelectTag = rxActionFactory.FromAsync <SelectableTagBaseViewModel>(selectTag);
        }
Ejemplo n.º 30
0
        public CalendarSettingsViewModel(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory,
            IOnboardingStorage onboardingStorage,
            IAnalyticsService analyticsService,
            INavigationService navigationService,
            IRxActionFactory rxActionFactory,
            IPermissionsChecker permissionsChecker)
            : base(userPreferences, interactorFactory, onboardingStorage, analyticsService, navigationService, rxActionFactory)
        {
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));

            this.permissionsChecker = permissionsChecker;

            RequestAccess            = rxActionFactory.FromAction(requestAccess);
            TogglCalendarIntegration = rxActionFactory.FromAsync(togglCalendarIntegration);

            CalendarListVisible = calendarListVisibleSubject.AsObservable().DistinctUntilChanged();
        }