12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using Xamarin.Forms;
- using System.Threading.Tasks;
- namespace comal.timesheets
- {
-
- public partial class MyTimesheets : BasePage
- {
- public MyTimesheets()
- {
- InitializeComponent();
- TimeSheets.Columns
- .BeginUpdate()
- .Clear()
- .Add(new MobileGridDateColumn<TimeSheetShell>()
- { Column = x => x.Date, Format = "dd MMM yy", Width = GridLength.Auto })
- .Add(new MobileGridDateColumn<TimeSheetShell>()
- { Column = x => x.Date, Format = "dddd", Width = GridLength.Star })
- .Add(new MobileGridTimeColumn<TimeSheetShell>()
- { Column = x => x.Start, Width = GridLength.Auto })
- .Add(new MobileGridTimeColumn<TimeSheetShell>()
- { Column = x => x.Finish, Width = GridLength.Auto })
- .Add(new MobileGridImageColumn<TimeSheetShell>() { Column = x => x.Approved, Width = 40 })
- .EndUpdate();
- }
- public void RefreshData(bool force)
- {
- App.Data.TimeSheets.Refresh(
- force,
- () => Device.BeginInvokeOnMainThread(
- () =>
- {
- TimeSheets.ItemsSource = App.Data.TimeSheets.Items;
- }
- )
- );
- }
-
- protected override void OnAppearing()
- {
- base.OnAppearing();
- RefreshData(false);
- }
-
- private void TimeSheets_OnRefreshRequested(object sender, MobileGridRefreshRequestArgs args)
- {
- RefreshData(true);
- }
-
- }
- }
|