public bool Previous() { FragmentTransaction ft = FragmentManager.BeginTransaction(); var fragment = new FragmentStockSelectTask(); ft.Replace(Resource.Id.main_content, fragment, ManageStockView.MainContentFragmentTag); ft.Commit(); return(true); }
protected override void OnCreate(Bundle savedState) { // restore view model from the saved state if (savedState != null) { string json = savedState.GetString(ViewModelBundleKey); ManageStockViewModel viewModel = JsonConvert.DeserializeObject <ManageStockViewModel>(json); this.ViewModel = viewModel; } base.OnCreate(savedState); this.ViewModel.RemoteProductService = new RemoteProductService("StockAllocation/Products"); this.ViewModel.DsrStockAllocationService = new DsrStockAllocationService(); SetContentView(Resource.Layout.layout_stock_allocation); this.AddToolbar(Resource.String.manage_stock, true); _btnNext = FindViewById <Button>(Resource.Id.btnNext); _btnPrev = FindViewById <Button>(Resource.Id.btnPrev); _btnNext.Click += GoNextOnClick; _btnPrev.Click += GoPrevOnClick; Fragment mainFragment = this.SupportFragmentManager.FindFragmentByTag(MainContentFragmentTag); if (mainFragment == null) { mainFragment = new FragmentStockSelectTask(); } this.SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.main_content, mainFragment, MainContentFragmentTag).Commit(); string snackbarMessage = this.GetString(Resource.String.turn_on_net_to_manage_stock); View mainContentView = this.FindViewById(Resource.Id.main_content); Snackbar snackbar = Snackbar.Make(mainContentView, snackbarMessage, Snackbar.LengthIndefinite); BindableSnackBar bindableSnackBar = new BindableSnackBar(snackbar); var set = this.CreateBindingSet <ManageStockView, ManageStockViewModel>(); set.Bind(bindableSnackBar).For(target => target.Visible).To(source => source.ShowNoInternetAlert); set.Apply(); }