Xamarin ios UItableView在后台使用任务计划程序清空行

时间:2016-09-27 17:30:07

标签: ios uitableview xamarin

当我在UITableView内加载UIApplication.SharedApplication.BeginInvokeOnMainThread()对象时,我在顶部有一个空行,但它没有使用TaskFactory就可以正常工作(没有空行)。

任何人都有任何想法?感谢您的时间和帮助。

var bounds = UIScreen.MainScreen.Bounds;
// show the loading overlay on the UI thread using the correct orientation sizing
loadingOverlay = new LoadingView(bounds, "Loading data...");
View.Add(loadingOverlay);
var context = TaskScheduler.FromCurrentSynchronizationContext() ;
var task = Task.Factory.StartNew(() =>
{
    ApprovalPendingList = CommonWebServices.GetPurchaseOrders(AppDelegate.SysproID);
    ApprovalPendingListClone = new List<Approval>(ApprovalPendingList);


}).ContinueWith((result) =>
{
    try
    {
        UIApplication.SharedApplication.BeginInvokeOnMainThread(() =>//UIApplication.SharedApplication.InvokeOnMainThread(() =>
        {
            tableViewApprovalList.Source = new TablePurchaseOrderPendingListSource(ApprovalPendingList);         
            Add(tableViewApprovalList);
            tableViewApprovalList.ReloadData(); 
            tableViewApprovalList.SizeToFit(); 
            UICommon.SetHeaderColor(this.NavigationController, this.NavigationItem, "Pending Orders");                             
        });
    }
    catch (Exception exp)
    {
        //  throw;
    }
});

0 个答案:

没有答案