public void UpdateTask(MobileTask task) { this.task = task; this.Description.Text = task.Description; this.DateDue.Text = task.DateDue != null ? task.DateDue.Value.ToString("ddd, M/d/yy h:mm tt") : "No Due Date"; SetStatusImage(task); }
private void SetStatusImage(MobileTask task) { if (task.IsCompleted) { this.Status.SetImage(new UIImage("IconCompleted"), UIControlState.Normal); } else if (task.DateDue < DateTime.Now) { this.Status.SetImage(new UIImage("IconPastDue"), UIControlState.Normal); } else { this.Status.SetImage(new UIImage("IconIncomplete"), UIControlState.Normal); } }
public override void ViewDidLoad() { base.ViewDidLoad(); NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, args) => { NavigationController.PopViewController(true); }), true); NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Save, async (sender, args) => { await this.Save(); }), true); //Busy.Hidden = true; HasDateDue.ValueChanged += (sender, args) => { DateDue.Hidden = !HasDateDue.On; }; if (task != null) { Description.Text = task.Description; Completed.On = task.IsCompleted; if (task.DateDue.HasValue) { HasDateDue.On = true; DateDue.Date = (NSDate)task.DateDue.Value; } else { HasDateDue.On = false; DateDue.Hidden = true; } } else { task = new MobileTask(); Completed.On = false; HasDateDue.On = false; DateDue.Hidden = true; } }
public async Task<MobileTask> UpsertTaskAsync(MobileTask task) { return await this.Client.InvokeApiAsync<MobileTask, MobileTask>("task", task); }
public void SetTask(MobileTask task) { this.task = task; }