/// <summary> /// /// Check the DB and if the task not exist for today then Assign new Task To Task List /// </summary> /// <returns></returns> public async Task AssignTodaysBoolTaskAsync() { if (TaskHolderList.Count == 0) { return; } var today = (int)DateTime.Now.DayOfWeek; foreach (var taskHolder in TaskHolderList) { var checkingDay = (0b00000001 << (today)); if ((taskHolder.WeeklyRepeatPattern & checkingDay) > 0) { var boolTypeTask = await DBAccess.GetTaskOnSpecificDateAsync(taskHolder.Title, DateTime.Now.ToString("G", CultureInfo.CreateSpecificCulture("es-ES"))); if (boolTypeTask == null) { boolTypeTask = new BoolTypeUserTask(taskHolder.DisplayTitle); } else { boolTypeTask.DisplayTitle = taskHolder.DisplayTitle; } taskHolder.CurrentTaskList.Add(boolTypeTask); boolTypeTask.ParentTaskHolder = taskHolder; boolTypeTask.OnDataChanged += UpdateCertainTask; BoolTypeTaskList.Add(boolTypeTask); } } }
/// <summary> /// Reset All Task List /// This usally happen when a day changes and an initial Step of the application.z /// </summary> /// <returns></returns> private async Task ResetBoolTypeTaskListAsync() { TaskHolderList.Clear(); BoolTypeTaskList.Clear(); await this.GetTaskHolderListAsync(); await this.AssignPastBoolTypeTasksAsync(); await this.AssignTodaysBoolTaskAsync(); }