public static List<TaskReminder> CalculateTaskReminder(Tasks task) { List<TaskReminder> taskReminders = new List<TaskReminder>(); if (task.DueDate == null) { task.Reminders = new List<TaskReminder>(); return taskReminders; } if (!task.HasReminder()) { return taskReminders; } long dueTime = GetTaskDueTime(task.DueDate.Value, task.IsAllDay); foreach (TaskReminder reminder in task.Reminders) { DateTime? remindTime = DateTimeUtils.CalculateRemindTime(reminder.Duration, dueTime); if (remindTime != null) { TaskReminder taskReminder = new TaskReminder(reminder); taskReminder.RemindTime = remindTime.Value; taskReminders.Add(taskReminder); } } return taskReminders; }
public TaskReminder(TaskReminder src) { Id = src.Id; Sid = src.Sid; UserId = src.UserId; TaskId = src.TaskId; TaskSid = src.TaskSid; Duration = new TickTickDuration(src.GetDurationString()); }
public static TaskReminder ConvertServerToLocal(Reminder serverReminder) { try { TaskReminder reminder = new TaskReminder(); reminder.Sid = serverReminder.Id; // TODO 由于比较复杂,暂时不实现 reminder.SetDuration(serverReminder.Trigger); return reminder; } catch (Exception e) { //Log.debugMultiReminder("convertServerToLocal failed, " + e.getMessage()); } return null; }