当我在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;
}
});