protected override void OnAppearing() { base.OnAppearing(); BindingContext = null; if (ToolbarItems.Count > 0) { ToolbarItems.RemoveAt(0); } InitializeComponent(); //_viewModel.LoadDataCommand.Execute(null); if (_viewModel.Dataset.Count == 0) { _viewModel.LoadDataCommand.Execute(null); } else if (_viewModel.NeedsRefresh()) { _viewModel.LoadDataCommand.Execute(null); } BindingContext = _viewModel; }
public void ViewModel_MonstersViewModel_SetNeedsRefresh_True_Should_Be_True() { MockForms.Init(); var myData = new MonstersViewModel(); myData.SetNeedsRefresh(true); var Actual = myData.NeedsRefresh(); var Expected = true; // Validate the controller can stand up and has a Title Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
// Constructor loads all the characters for display public PickCharacter() { InitializeComponent(); partyList = new List <Character>(); PartyList.ItemsSource = partyList; BindingContext = _viewModel = CharactersViewModel.Instance; // Grabs a copy of the monsters _monsterViewModel = MonstersViewModel.Instance; if (_monsterViewModel.Dataset.Count == 0) { _monsterViewModel.LoadDataCommand.Execute(null); } else if (_monsterViewModel.NeedsRefresh()) { _monsterViewModel.LoadDataCommand.Execute(null); } }