private void Load(TaskModel task) { if (task != null) { Task = task; IsNew = false; } else { Task = new TaskModel(); IsNew = true; App.Tasks.Add(Task); } // Výchozí hodnoty DateTime?defaultDate = Settings.Current.DefaultDate; DateTime defaultTime = Settings.Current.DefaultTime; // Datum & čas IsSetDueDate = Task.HasDueDate; if (IsSetDueDate) { DueDate = Task.DueDate.Value; } else { DueDate = (defaultDate ?? DateTime.Today); DueDate = DueDate.AddHours(defaultTime.Hour).AddMinutes(defaultTime.Minute); if (IsNew) { IsSetDueDate = defaultDate != null; } } // Připomenutí IsSetReminder = Task.HasReminder; if (IsSetReminder) { Reminder = Task.Reminder.Value; } else if (IsNew) { IsSetReminder = Settings.Current.TurnOnReminder; if (IsSetReminder) { Reminder = TaskModel.ReminderInDueTime; } } // Opakování IsSetRepeats = Task.Repeats != Repeats.None; Repeats = Task.Repeats; }