コード例 #1
0
        //on appearing, loads any new information from the view model
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            //removes the first toolbar item
            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            //if needed to refresh or dataset is empty, refresh from database
            if (_viewModel.Dataset.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext = _viewModel;
        }
コード例 #2
0
        public void ViewModel_ScoresViewModel_SetNeedsRefresh_True_Should_Be_True()
        {
            MockForms.Init();

            var myData = new ScoresViewModel();

            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);
        }
コード例 #3
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            if (_viewModel.Dataset.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext = _viewModel;
        }