using System.Linq; using Comal.Classes; using Xamarin.Forms.Xaml; using SelectionChangedEventArgs = Syncfusion.XForms.Buttons.SelectionChangedEventArgs; namespace comal.timesheets { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class SiteTasks : SitePage { public SiteTasks() { InitializeComponent(); Tasks.Columns .BeginUpdate() .Add(new MobileGridIntegerColumn() { Column = x=>x.Number }) .Add(new MobileGridTextColumn() { Column = x=>x.Title }) .Add(new MobileGridTextColumn() { Column = x=>x.Type }) .Add(new MobileGridDateColumn() { Column = x=>x.DueDate, Format = "dd MMM yy"}) .Clear() .EndUpdate(); } protected override void JobLoaded() { ReloadData(false); } private void ReloadData(bool force) { if (force) Job.Refresh(true, () => Dispatcher.BeginInvokeOnMainThread(KanbansLoaded)); else KanbansLoaded(); } private void KanbansLoaded() { Tasks.ItemsSource = Job.Kanbans.Where(kanban => kanban.Category == Kanban.ALL[TaskType.SelectedIndex]); } private void Tasks_OnRefreshRequested(object sender, MobileGridRefreshRequestArgs args) { ReloadData(true); } private void Tasks_OnSelectionChanged(object sender, MobileGridSelectionArgs args) { // Edit the Task Here (single) // Alternatively, assign to someone (bulk) } private void TaskType_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ReloadData(false); } } }