Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

Add Main Thread Detection #240

@craylward

Description

@craylward

Use Case: Obtaining the main thread for Xamarin Forms UI navigation from a method that may or may not be running in the background thread.

Part of: Platform

API:

- bool IsMainThread { get; }
void NavigationMethod()
{
   if (Platform.IsMainThread)
   {
      Navigate();
   }
   else
   {
      Device.BeginInvokeOnMainThread(Navigate());
   }
}

Android: Looper.MyLooper == MainLooper
iOS: NSThread.Current.IsMainThread

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressActively being worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions