示例#1
0
        private string GetGeneralDescription()
        {
            AutoDeleteFrequency autodelete = this.Workbook.Settings.GetValue <AutoDeleteFrequency>(CoreSettings.AutoDeleteFrequency);

            return(string.Format(
                       StringResources.OptionSettingsPage_DescriptionTasksFormat,
                       (int)autodelete,
                       this.Settings.GetValue <CompletedTaskMode>(CoreSettings.CompletedTasksMode).GetDescription().ToLower()));
        }
 public static string GetDescription(this AutoDeleteFrequency frequency)
 {
     return(descriptions[frequency]);
 }
        public GeneralSettingsPageViewModel(IWorkbook workbook, INavigationService navigationService, ITileManager tileManager)
            : base(workbook, navigationService)
        {
            if (tileManager == null)
            {
                throw new ArgumentNullException(nameof(tileManager));
            }

            this.tileManager           = tileManager;
            this.defaultContextChoices = new List <IContext>(this.Workbook.Contexts);
            this.defaultContextChoices.Insert(0, null);

            this.badgeValues = new List <IAbstractFolder> {
                new Folder {
                    Name = StringResources.Settings_NoBadgeValue.ToLowerInvariant()
                }
            };
            this.badgeValues.AddRange(this.Workbook.Views);
            this.badgeValues.AddRange(this.Workbook.SmartViews);
            this.badgeValues.AddRange(this.Workbook.Folders);
            this.badgeValues.AddRange(this.Workbook.Contexts);
            this.badgeValues.AddRange(this.Workbook.Tags);

            AutoDeleteFrequency frequency = this.Settings.GetValue <AutoDeleteFrequency>(CoreSettings.AutoDeleteFrequency);

            this.selectedAutoDelete = frequency.GetDescription();

            TaskPriority priority = this.Settings.GetValue <TaskPriority>(CoreSettings.DefaultPriority);

            this.selectedDefaultPriority = priority.GetDescription();

            string badgeValue = this.Settings.GetValue <string>(CoreSettings.BadgeValue);

            if (!string.IsNullOrWhiteSpace(badgeValue))
            {
                var descriptor = LaunchArgumentsHelper.GetDescriptorFromArgument(this.Workbook, badgeValue);
                if (descriptor != null && descriptor.Folder != null)
                {
                    this.originalSelectedBadgeValue = descriptor.Folder;
                    this.selectedBadgeValue         = descriptor.Folder;
                }
            }

            if (this.selectedBadgeValue == null)
            {
                this.selectedBadgeValue = this.badgeValues[0];
            }

            int      contextId      = this.Settings.GetValue <int>(CoreSettings.DefaultContext);
            IContext defaultContext = this.Workbook.Contexts.FirstOrDefault(c => c.Id == contextId);

            if (defaultContext != null)
            {
                this.selectedDefaultContext = defaultContext;
            }

            DefaultDate defaultDueDate = this.Settings.GetValue <DefaultDate>(CoreSettings.DefaultDueDate);

            this.selectedDefaultDueDate = defaultDueDate.GetDescription();

            DefaultDate defaultStartDate = this.Settings.GetValue <DefaultDate>(CoreSettings.DefaultStartDate);

            this.selectedDefaultStartDate = defaultStartDate.GetDescription();

            CompletedTaskMode completedTaskMode = this.Settings.GetValue <CompletedTaskMode>(CoreSettings.CompletedTasksMode);

            this.selectedCompletedTaskMode = completedTaskMode.GetDescription();

            this.useGroupedDates          = this.Settings.GetValue <bool>(CoreSettings.UseGroupedDates);
            this.showNoDueWithOther       = this.Settings.GetValue <bool>(CoreSettings.IncludeNoDateInViews);
            this.showFutureStartDates     = this.Settings.GetValue <bool>(CoreSettings.ShowFutureStartDates);
            this.autoDeleteTags           = this.Settings.GetValue <bool>(CoreSettings.AutoDeleteTags);
            this.completeTaskSetsProgress = this.Settings.GetValue <bool>(CoreSettings.CompleteTaskSetProgress);
        }