示例#1
0
        private void UpdateTimeOptions()
        {
            if (Class == null)
            {
                return;
            }

            if (Class.IsNoClassClass || !PowerPlannerApp.DoesClassOccurOnDate(Account, Date, Class))
            {
                MakeTimeOptionsLike(new string[]
                {
                    TimeOption_AllDay,
                    TimeOption_Custom
                });
            }
            else
            {
                switch (Type)
                {
                case TaskOrEventType.Task:
                    MakeTimeOptionsLike(new string[]
                    {
                        TimeOption_BeforeClass,
                        TimeOption_StartOfClass,
                        TimeOption_DuringClass,
                        TimeOption_EndOfClass,
                        TimeOption_AllDay,
                        TimeOption_Custom
                    });
                    break;

                case TaskOrEventType.Event:
                    MakeTimeOptionsLike(new string[]
                    {
                        TimeOption_AllDay,
                        TimeOption_DuringClass,
                        TimeOption_Custom
                    });
                    break;
                }
            }

            if (!TimeOptions.Contains(SelectedTimeOption))
            {
                if (Type == TaskOrEventType.Event && TimeOptions.Length == 3)
                {
                    SelectedTimeOption = TimeOptions[1];
                }
                else
                {
                    SelectedTimeOption = TimeOptions.First();
                }

                _userChangedSelectedTimeOption = false;
            }
            else
            {
                OnPropertyChanged(nameof(SelectedTimeOption));
            }
        }
示例#2
0
        /// <summary>
        /// Gets the time option with the class schedule factored in
        /// </summary>
        /// <returns></returns>
        public DataItemMegaItem.TimeOptions GetActualTimeOption()
        {
            switch (TimeOption)
            {
            case DataItemMegaItem.TimeOptions.AllDay:
                return(DataItemMegaItem.TimeOptions.AllDay);

            case DataItemMegaItem.TimeOptions.Custom:
                return(DataItemMegaItem.TimeOptions.Custom);
            }

            var c = GetClassOrNull();

            if (c == null || c.IsNoClassClass || !PowerPlannerApp.DoesClassOccurOnDate(Account, Date, c))
            {
                return(DataItemMegaItem.TimeOptions.AllDay);
            }

            return(TimeOption);
        }