本文整理汇总了C#中UINavigationController.BeginInvokeOnMainThread方法的典型用法代码示例。如果您正苦于以下问题:C# UINavigationController.BeginInvokeOnMainThread方法的具体用法?C# UINavigationController.BeginInvokeOnMainThread怎么用?C# UINavigationController.BeginInvokeOnMainThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UINavigationController
的用法示例。
在下文中一共展示了UINavigationController.BeginInvokeOnMainThread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartOnAddContactAction
private void StartOnAddContactAction(UINavigationController navigationController, User user)
{
AddressBook book = new AddressBook ();
book.RequestPermission ().ContinueWith (task => {
navigationController.BeginInvokeOnMainThread (delegate {
if (task.IsFaulted || task.IsCanceled || !task.Result)
{
ShowNoContactAccess ();
}
else
{
_canAccessAddress = true;
CheckForExistingAndContinue (navigationController, user, false);
}
});
},TaskScheduler.FromCurrentSynchronizationContext());
}
示例2: CheckForExistingAndContinue
private void CheckForExistingAndContinue(UINavigationController navigationController,
User user, bool mainThreadRequired)
{
KeyValuePair <string, string> namePair = GetFirstAndLastName (user);
string firstName = namePair.Key;
string lastName = namePair.Value;
AddressBook book = new AddressBook ();
foreach (Contact contact in book)
{
if (contact.FirstName == firstName &&
contact.LastName == lastName)
{
if (!mainThreadRequired)
AskShouldAddDuplicateAndContinue (navigationController, user);
else
{
navigationController.BeginInvokeOnMainThread (delegate {
AskShouldAddDuplicateAndContinue (navigationController, user);
});
}
return;
}
}
if (!mainThreadRequired)
ShowAddContactController (navigationController, user);
else
{
navigationController.BeginInvokeOnMainThread (delegate {
ShowAddContactController (navigationController, user);
});
}
}