void datePicked(bool nowPicked, DateTime date) { BusTableModel model = ((ArrivalListTableViewSource)busTable.Source).model; if (nowPicked) { model.FutureTime = null; this.currentDateLabel.Text = "Now"; } else { model.FutureTime = date; if (date.Date == DateTime.Today) { this.currentDateLabel.Text = "Today, " + date.ToString("h:mm tt"); } else if (date.Date == DateTime.Today.AddDays(1.0)) { this.currentDateLabel.Text = "Tomorrow, " + date.ToString("h:mm tt"); } else { this.currentDateLabel.Text = date.ToString("MMM d, h:mm tt"); } } }
private void arrivalsUpdated(BusTableModel source) { InvokeOnMainThread(delegate { tableView.ReloadData(); //tableView.ReloadSections(MonoTouch.Foundation.NSIndexSet.FromIndex(0), UITableViewRowAnimation.Automatic); }); }
partial void changeDateTouched(NSObject sender) { BusTableModel model = ((ArrivalListTableViewSource)busTable.Source).model; //default to the already selected date, if there is one if (model.FutureTime.HasValue) { datePickerSheet = new DatePickerView(model.FutureTime.Value); } else //will be null if using now { datePickerSheet = new DatePickerView(); } datePickerSheet.DatePicked += datePicked; datePickerSheet.ShowInActionSheet(this.View); timeButtonView.BackgroundColor = buttonNormalColor; }
public ArrivalListTableViewSource(UITableView tableView) { this.tableView=tableView; model=new BusTableModel(); model.ArrivalsUpdated+=arrivalsUpdated; }
public ArrivalListTableViewSource(UITableView tableView) { this.tableView = tableView; model = new BusTableModel(); model.ArrivalsUpdated += arrivalsUpdated; }