コード例 #1
0
        /// <summary>
        /// Refresh the list on page appearing
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            // If no data, then set it for needing refresh
            if (ViewModel.Dataset.Count == 0)
            {
                ViewModel.SetNeedsRefresh(true);
            }

            // If the needs Refresh flag is set update it
            if (ViewModel.NeedsRefresh())
            {
                ViewModel.LoadDatasetCommand.Execute(null);
            }

            BindingContext = ViewModel;
        }
コード例 #2
0
        /// <summary>
        /// Refresh the list on page appearing
        /// </summary>
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            // If no data, then reload the data
            if (viewModel.Dataset.Count == 0)
            {
                viewModel.SetNeedsRefresh(true);
            }

            // Refresh if flag is set
            if (viewModel.NeedsRefresh())
            {
                viewModel.LoadDatasetCommand.Execute(null);
            }

            BindingContext = viewModel;
        }
コード例 #3
0
        public void ItemIndexViewModel_SetNeedsRefresh_Valid_True_Should_Pass()
        {
            // Arrange
            var originalState = ViewModel.GetNeedsRefresh();

            // Act
            ViewModel.SetNeedsRefresh(true);
            var newState = ViewModel.GetNeedsRefresh();

            // Reset

            // Turn it back to the original state
            ViewModel.SetNeedsRefresh(originalState);

            // Assert
            Assert.AreEqual(true, newState);
        }