public static string Title(this CalendarNotificationsOption option)
        {
            switch (option)
            {
            case CalendarNotificationsOption.Disabled:
                return(Resources.Disabled);

            case CalendarNotificationsOption.WhenEventStarts:
                return(Resources.WhenEventStarts);

            case CalendarNotificationsOption.FiveMinutes:
                return(Resources.FiveMinutes);

            case CalendarNotificationsOption.TenMinutes:
                return(Resources.TenMinutes);

            case CalendarNotificationsOption.FifteenMinutes:
                return(Resources.FifteenMinutes);

            case CalendarNotificationsOption.ThirtyMinutes:
                return(Resources.ThirtyMinutes);

            case CalendarNotificationsOption.OneHour:
                return(Resources.OneHour);
            }
            return("");
        }
        private void onSelectOption(CalendarNotificationsOption option)
        {
            var enabled = option != CalendarNotificationsOption.Disabled;

            userPreferences.SetCalendarNotificationsEnabled(enabled);

            if (enabled)
            {
                userPreferences.SetTimeSpanBeforeCalendarNotifications(option.Duration());
            }

            navigationService.Close(this, Unit.Default);
        }
            public async Task SavesTheSelectedOption(CalendarNotificationsOption option, bool enabled, int minutes)
            {
                ViewModel.SelectOption.Execute(option);

                TestScheduler.Start();
                UserPreferences.Received().SetCalendarNotificationsEnabled(enabled);

                if (enabled)
                {
                    UserPreferences.Received().SetTimeSpanBeforeCalendarNotifications(Arg.Is <TimeSpan>(arg => arg == TimeSpan.FromMinutes(minutes)));
                }
                else
                {
                    UserPreferences.DidNotReceive().SetTimeSpanBeforeCalendarNotifications(Arg.Any <TimeSpan>());
                }

                await NavigationService.Received().Close(Arg.Any <UpcomingEventsNotificationSettingsViewModel>(), Unit.Default);
            }
            public async Task SavesTheSelectedOption(CalendarNotificationsOption option, bool enabled, int minutes)
            {
                var selectableOption = new SelectableCalendarNotificationsOptionViewModel(option, false);

                ViewModel.SelectOption.Execute(selectableOption);

                TestScheduler.Start();
                UserPreferences.Received().SetCalendarNotificationsEnabled(enabled);

                if (enabled)
                {
                    UserPreferences.Received().SetTimeSpanBeforeCalendarNotifications(Arg.Is <TimeSpan>(arg => arg == TimeSpan.FromMinutes(minutes)));
                }
                else
                {
                    UserPreferences.DidNotReceive().SetTimeSpanBeforeCalendarNotifications(Arg.Any <TimeSpan>());
                }

                View.Received().Close();
            }
        public static TimeSpan Duration(this CalendarNotificationsOption option)
        {
            switch (option)
            {
            case CalendarNotificationsOption.WhenEventStarts:
                return(TimeSpan.Zero);

            case CalendarNotificationsOption.FiveMinutes:
                return(TimeSpan.FromMinutes(5));

            case CalendarNotificationsOption.TenMinutes:
                return(TimeSpan.FromMinutes(10));

            case CalendarNotificationsOption.FifteenMinutes:
                return(TimeSpan.FromMinutes(15));

            case CalendarNotificationsOption.ThirtyMinutes:
                return(TimeSpan.FromMinutes(30));

            case CalendarNotificationsOption.OneHour:
                return(TimeSpan.FromHours(1));
            }
            return(TimeSpan.Zero);
        }
 private SelectableCalendarNotificationsOptionViewModel toSelectableOption(CalendarNotificationsOption option)
 => new SelectableCalendarNotificationsOptionViewModel(option, false);
Beispiel #7
0
 public SelectableCalendarNotificationsOptionViewModel(CalendarNotificationsOption option, bool selected)
 {
     Option   = option;
     Selected = selected;
 }