/// <summary>
        /// Gets a table that contains information about tasks. The table can be used to bind
        /// visual controls that display a list of tasks either in Windows and ASP.NET applications.
        /// </summary>
        public TaskData.TaskDataTable GetTaskDataTable()
        {
            TaskData.TaskDataTable table = new TaskData.TaskDataTable();
            PatternParser parser = new PatternParser();

            foreach (DictionaryEntry entry in mTasks)
            {
                Task task = (Task)entry.Value;
                parser.Parse(task.Pattern);
                bool isCustom = (parser.PatternType == PatternType.Custom);

                table.AddTaskRow(task.Id, task.Name, (isCustom) ? "Custom" : parser.Schedule, parser.StartsOn, parser.EndsOn, isCustom);
            }

            return table;
        }
        /// <summary>
        /// Transfers information from a Task object into a data row.
        /// </summary>
        public EditTaskFormData.TaskRow LoadTask(Task task)
        {
            PatternParser parser = new PatternParser();
            if (!parser.Parse(task.Pattern))
                throw new Exception("This is not a simple pattern.");

            mTaskData = NewTask();
            mTask = task;
            mRule = mTask.Pattern.RRules[0];

            //Load task name
            mTaskData.Name = task.Name;

            //Load the recurrence rule
            switch (parser.PatternType)
            {
                case PatternType.Daily:
                    LoadDaily();
                    break;
                case PatternType.Weekly:
                    LoadWeekly();
                    break;
                case PatternType.MonthlyDay:
                    LoadMonthlyDay();
                    break;
                case PatternType.MonthlyDayOfWeek:
                    LoadMonthlyDayOfWeek();
                    break;
                case PatternType.MonthlyWeekDay:
                    LoadMonthlyWeekDay();
                    break;
                case PatternType.YearlyDay:
                    LoadYearlyDay();
                    break;
                case PatternType.YearlyDayOfWeek:
                    LoadYearlyDayOfWeek();
                    break;
                case PatternType.YearlyWeekDay:
                    LoadYearlyWeekDay();
                    break;
                default:
                    throw new Exception("Unknown pattern type.");
            }

            //Load the range of the pattenr
            mTaskData.StartDate = DemoUtil.FormatDate(task.Pattern.StartDate);
            mTaskData.StartTime = DemoUtil.FormatTime(task.Pattern.StartDate);
            mTaskData.EndChoice = (int)mRule.EndType;
            switch (mRule.EndType)
            {
                case EndType.None:
                    //Do nothing
                    break;
                case EndType.Count:
                    mTaskData.Count = mRule.Count.ToString();
                    break;
                case EndType.Until:
                    mTaskData.EndDate = DemoUtil.FormatDate(mRule.Until);
                    break;
                default:
                    throw new Exception("Unknown end type.");
            }

            return mTaskData;
        }