public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { base.OnCreateView(inflater, container, savedState); View view = this.BindingInflate(Resource.Layout.fragment_commission_summary, null); SwipeLinearLayout swipeLayout = view as SwipeLinearLayout; if (swipeLayout != null) { swipeLayout.Swipe += Swipe; } DateTime monthToLoad = DateTime.Now; int monthdelta = 0; bool nextVisible = false; bool previousVisible = true; if (savedState != null) { string dateString = savedState.GetString(CurrentMonthBundleKey); monthToLoad = DateTime.Parse(dateString); monthdelta = savedState.GetInt(MonthDeltaBundleKey); } else { // Get intial data from the arguments if (this.Arguments != null) { string dateString = this.Arguments.GetString(CurrentMonthBundleKey); monthToLoad = DateTime.Parse(dateString); monthdelta = this.Arguments.GetInt(MonthDeltaBundleKey); } } if (monthdelta > 0) { nextVisible = true; } if (monthdelta >= SummaryViewModel.MaxBackScrollMonths) { previousVisible = false; } BindableOverlayFragment suspendedOverlay = new BindableOverlayFragment(SuspendedOverlay, this.parentActivity, Resource.Id.main_content); BindableOverlayFragment noDataOverlay = new BindableOverlayFragment(NoDataOverlay, this.parentActivity, Resource.Id.main_content); vm = new SummaryViewModel(monthToLoad) { GoToDetailsScreen = this.GoToDetailsScreen, HasDetailsFunction = this.HasDetails, MonthLoaded = this.MonthLoaded, MonthDelta = monthdelta, NextVisible = nextVisible, PreviousVisible = previousVisible }; this.ViewModel = vm; var set = this.CreateBindingSet <FragmentCommissionSummary, SummaryViewModel>(); set.Bind(this.parentActivity.SwipeRefreshLayout).For(target => target.Refreshing).To(model => model.Busy); set.Bind(suspendedOverlay).For(target => target.Visible).To(model => model.Suspended); set.Bind(noDataOverlay).For(target => target.Visible).To(model => model.NoData); set.Apply(); vm.LoadMonthData(monthToLoad); return(view); }
public async Task LoadData() { await vm.LoadMonthData(vm.ThisMonth); }