public void ReloadGrid()
 {
     ApplicationController.DoOnAsyncThread(() =>
     {
         try
         {
             GridLoadError = false;
             GridLoaded    = false;
             LoadingViewModel.IsLoading = true;
             Thread.Sleep(100);
             if (OnReloading != null)
             {
                 OnReloading();
             }
             var getRecordsResponse = GetGridRecords(false);
             var records            = getRecordsResponse.Records;
             TotalCount             = DisplayTotalCount && GetTotalCount != null
                 ? GetTotalCount()
                 : (int?)null;
             ApplicationController.DoOnMainThread(() =>
             {
                 try
                 {
                     GridRecords = GridRowViewModel.LoadRows(records, this, isReadOnly: IsReadOnly);
                     OnPropertyChanged(nameof(PageDescription));
                     HasMoreRows = getRecordsResponse.HasMoreRecords;
                 }
                 catch (Exception ex)
                 {
                     GridLoadError = true;
                     ErrorMessage  = string.Format("There was an error loading data into the grid: {0}", ex.DisplayString());
                 }
                 LoadingViewModel.IsLoading = false;
                 if (!GridLoadError)
                 {
                     GridLoaded = true;
                 }
                 if (LoadedCallback != null)
                 {
                     LoadedCallback();
                 }
             });
         }
         catch (Exception ex)
         {
             GridLoadError = true;
             ErrorMessage  = string.Format("There was an error loading data into the grid: {0}", ex.DisplayString());
             ApplicationController.LogEvent("Grid Load Error", new Dictionary <string, string> {
                 { "Is Error", true.ToString() }, { "Error", ex.Message }, { "Error Trace", ex.DisplayString() }, { "Record Type", RecordType }
             });
             if (LoadedCallback != null)
             {
                 LoadedCallback();
             }
             LoadingViewModel.IsLoading = false;
         }
     });
 }
        public void ReloadGrid()
        {
            ApplicationController.DoOnAsyncThread(() =>
            {
                try
                {
                    GridLoadError = false;
                    GridLoaded    = false;
                    LoadingViewModel.IsLoading = true;
                    Thread.Sleep(100);
                    if (OnReloading != null)
                    {
                        OnReloading();
                    }
                    var getRecordsResponse = GetGridRecords(false);
                    var records            = getRecordsResponse.Records;

                    ApplicationController.DoOnMainThread(() =>
                    {
                        try
                        {
                            GridRecords = GridRowViewModel.LoadRows(records, this, isReadOnly: IsReadOnly);
                            OnPropertyChanged(nameof(PageDescription));
                            HasMoreRows = getRecordsResponse.HasMoreRecords;
                        }
                        catch (Exception ex)
                        {
                            GridLoadError = true;
                            ErrorMessage  = string.Format("There was an error loading data into the grid: {0}", ex.DisplayString());
                        }
                        LoadingViewModel.IsLoading = false;
                        if (!GridLoadError)
                        {
                            GridLoaded = true;
                        }
                        if (LoadedCallback != null)
                        {
                            LoadedCallback();
                        }
                    });
                }
                catch (Exception ex)
                {
                    GridLoadError = true;
                    ErrorMessage  = string.Format("There was an error loading data into the grid: {0}", ex.DisplayString());
                    if (LoadedCallback != null)
                    {
                        LoadedCallback();
                    }
                    LoadingViewModel.IsLoading = false;
                }
            });
        }