public void OnReceive(TaskStatusCompletedMessage message) { var task = MyTasks.FirstOrDefault(x => x.id == message.Id); if (task != null) { MyTasks.Remove(task); } task = DueTodayTasks.FirstOrDefault(x => x.id == message.Id); if (task != null) { DueTodayTasks.Remove(task); } task = DueTomorrowTasks.FirstOrDefault(x => x.id == message.Id); if (task != null) { DueTomorrowTasks.Remove(task); } task = DueWeekendTasks.FirstOrDefault(x => x.id == message.Id); if (task != null) { DueWeekendTasks.Remove(task); } }
public void OnNavigatedTo(NavigationParameters parameters) { //para.Add("current", MyItemSelected); //para.Add("SaveData", SaveData); //para.Add("EditMode", EditMode); if (parameters.ContainsKey("EditMode")) { EditMode = (bool)parameters["EditMode"]; if (parameters.ContainsKey("current")) { var fooUpdateItem = parameters["current"] as MyItem; if (parameters.ContainsKey("SaveData")) { var fooSaveData = (bool)parameters["SaveData"]; // 開始進行資料的 CRUD 處理 if (EditMode == true) { if (fooSaveData == true) { var fooItem = MyTasks.FirstOrDefault(x => x.Id == fooUpdateItem.Id); if (fooItem != null) { fooItem.Name = fooUpdateItem.Name; fooItem.Status = fooUpdateItem.Status; fooItem.Date = fooUpdateItem.Date; } } else { var fooItem = MyTasks.FirstOrDefault(x => x.Id == fooUpdateItem.Id); if (fooItem != null) { MyTasks.Remove(fooItem); } } } else { // Add New Item MyTasks.Insert(0, fooUpdateItem); } } } } Refresh(); }