[Handler(Thread.IHandler)] public class Thread : Widget
Provides access to platform-specific threading. Not all platforms implement this as you can use System.Threading.Thread instead in most cases.
Remarks: Most platforms have a concept of threads, though some (e.g. WinRT) do not. This may be removed in a future version in favour of using Task.Run(), Task.Delay(), which works across all platforms on .net 4.5+ and PCL.

Constructors

Thread

#
public Thread(Action action)
Initializes a new instance of the Thread class for a specific ation

Properties

ControlObject

public object ControlObject { get; }
Gets the instance of the platform-specific object
inherited fromWidget
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.

CurrentThread

#
public static Thread CurrentThread { get; }
Gets the current thread instance

Handler

public object Handler { get; }
Gets the platform-specific handler for this widget
inherited fromWidget

IsAlive

#
public bool IsAlive { get; }
Gets a value indicating whether this thread is alive.

IsDisposed

public bool IsDisposed { get; }
Gets or sets a value indicating whether this Widget has been disposed.
inherited fromWidget
Remarks: When the widget is disposed, it can no longer be used.
true if this instance has been disposed; otherwise, false.

IsMain

#
public bool IsMain { get; }
Gets a value indicating whether this thread instance is the main UI thread.
true if this thread instance is the main UI thread; otherwise, false.

IsMainThread

#
public static bool IsMainThread { get; }
Gets a value indicating if the current thread is the main UI thread.
true if the current thread is the main UI thread; otherwise, false.

MainThread

#
public static Thread MainThread { get; }
Gets the main thread.

NativeHandle

public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget

Platform

public Platform Platform { get; }
Gets the platform that was used to create the Widget.Handler for this widget
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object

Properties

public PropertyStore Properties { get; }
Gets the dictionary of properties for this widget
inherited fromWidget

Style

public string Style { get; set; }
Gets or sets the style of this widget
inherited fromWidget
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
// in your UI
var control = new Button { Style = "mystyle" };

// in your platform assembly
using Eto.Mac.Forms.Controls;

Styles.AddHandler<ButtonHandler>("mystyle", handler => {
	// this is where you can use handler.Control to set properties, handle events, etc.
	handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});

Methods

Abort

#
public void Abort()
Abort this instance, for custom thread instances

Dispose

protected virtual void Dispose(bool disposing)
Handles the disposal of this widget
inherited fromWidget
disposing (bool)True if the caller called Widget.Dispose() manually, false if being called from a finalizer

GetCallback

#
protected override object GetCallback()
Gets an instance of an object used to perform callbacks to the widget from handler implementations

Initialize

protected void Initialize()
Initializes the widget handler
inherited fromWidget
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.

OnExecuted

#
protected virtual void OnExecuted()
Called when the thread is executed, for custom thread instances

OnStyleChanged

protected virtual void OnStyleChanged(EventArgs e)
Handles when the Widget.Style is changed.
inherited fromWidget

ToString

public override string ToString()
Gets a string that represents the current object with its ID if specified.
inherited fromWidget
A string value indicating the type and ID (if specified) of this widget.
Object.ToString

Events