Table of Contents

Class Ui

Namespace
Tripous.Desktop
Assembly
Tripous.Desktop.dll

Constants

public static class Ui
Inheritance
Ui
Inherited Members

Fields

SShowDataFormFactBoxPane

The name of the command to show the DataForm FactBox pane.

public const string SShowDataFormFactBoxPane = "ShowDataFormFactBoxPane"

Field Value

string

SShowDataFormLog

The name of the command to show the DataForm log.

public const string SShowDataFormLog = "ShowDataFormLog"

Field Value

string

Properties

MainWindow

The main window.

public static Window MainWindow { get; set; }

Property Value

Window

Settings

UI global settings.

public static UiGlobalSettings Settings { get; }

Property Value

UiGlobalSettings

Methods

CreateContainerNode(string, object, string, double, int)

Creates a container Avalonia.Controls.TreeViewItem node with an image.

public static TreeViewItem CreateContainerNode(string Caption, object Tag = null, string IconFile = "folder16.png", double Spacing = 5, int NegativeMargin = -8)

Parameters

Caption string

The node caption.

Tag object

The node tag.

IconFile string

The icon file name.

Spacing double

The content spacing.

NegativeMargin int

The negative left margin.

Returns

TreeViewItem

The created tree view item.

CreateLeafNode(string, object, string, double, int)

Creates a leaf Avalonia.Controls.TreeViewItem node with an image.

public static TreeViewItem CreateLeafNode(string Caption, object Tag = null, string IconFile = "item16.png", double Spacing = 5, int NegativeMargin = 0)

Parameters

Caption string

The node caption.

Tag object

The node tag.

IconFile string

The icon file name.

Spacing double

The content spacing.

NegativeMargin int

The negative left margin.

Returns

TreeViewItem

The created tree view item.

CreateTreeNode(string, FontWeight, string, object, double, int)

Creates a Avalonia.Controls.TreeViewItem node with an image.

public static TreeViewItem CreateTreeNode(string Caption, FontWeight FontWeight, string IconFile, object Tag, double Spacing = 5, int NegativeMargin = 0)

Parameters

Caption string

The node caption.

FontWeight FontWeight

The caption font weight.

IconFile string

The icon file name.

Tag object

The node tag.

Spacing double

The content spacing.

NegativeMargin int

The negative left margin.

Returns

TreeViewItem

The created tree view item.

Debug(Exception)

Writes an exception to the debug output.

public static void Debug(Exception e)

Parameters

e Exception

The exception.

Debug(string)

Writes debug text to the UI log or debug output.

public static void Debug(string Text)

Parameters

Text string

The text to write.

ExpandAll(ItemsControl, bool)

Expands or collapses all items in a TreeView or TreeViewItem.

public static void ExpandAll(ItemsControl Control, bool Flag)

Parameters

Control ItemsControl

The items control.

Flag bool

True to expand; false to collapse.

ExpandAll(TreeView, bool)

Expands or collapses all items in a TreeView.

public static void ExpandAll(this TreeView tv, bool Flag)

Parameters

tv TreeView

The tree view.

Flag bool

True to expand; false to collapse.

ExpandAll(TreeViewItem, bool)

Expands or collapses all items in TreeViewItem.

public static void ExpandAll(this TreeViewItem Node, bool Flag)

Parameters

Node TreeViewItem

The tree view item.

Flag bool

True to expand; false to collapse.

GetOwnerWindow(Control)

Returns the owner window of a control.

public static Window GetOwnerWindow(this Control Control)

Parameters

Control Control

The control.

Returns

Window

The owner window.

GetParentWindow(Control)

Returns the parent window of a control.

public static Window GetParentWindow(this Control Control)

Parameters

Control Control

The control.

Returns

Window

The parent window, if any; otherwise, null.

InputBox(string, string, Control)

Shows an input box dialog.

public static Task<InputBoxData> InputBox(string Message, string Value = "", Control Caller = null)

Parameters

Message string

The dialog message.

Value string

The initial value.

Caller Control

The caller control.

Returns

Task<InputBoxData>

The input box data.

OpenFileDialog(Control, params string[])

Shows an open file dialog.

public static Task<string> OpenFileDialog(Control Caller, params string[] Extensions)

Parameters

Caller Control

The caller control.

Extensions string[]

The allowed file extensions.

Returns

Task<string>

The selected file path, if any; otherwise, null.

Post(Action)

Executes an action on the UI thread (fire-and-forget).

Supports both synchronous and asynchronous delegates.

Ui.Post(async () => await DoSomethingAsync());
public static void Post(Action Proc)

Parameters

Proc Action

The action to execute.

Post(Action, DispatcherPriority)

Executes an action on the UI thread (fire-and-forget).

Supports both synchronous and asynchronous delegates.

Ui.Post(async () => await DoSomethingAsync());
public static void Post(Action Proc, DispatcherPriority Priority)

Parameters

Proc Action

The action to execute.

Priority DispatcherPriority

The dispatcher priority.

Post(Func<Task>)

Executes an action on the UI thread (fire-and-forget).

Supports both synchronous and asynchronous delegates.

Ui.Post(async () => await DoSomethingAsync());
public static void Post(Func<Task> Func)

Parameters

Func Func<Task>

The function to execute.

Post(Func<Task>, DispatcherPriority)

Executes an action on the UI thread (fire-and-forget).

Supports both synchronous and asynchronous delegates.

Ui.Post(async () => await DoSomethingAsync());
public static void Post(Func<Task> Func, DispatcherPriority Priority)

Parameters

Func Func<Task>

The function to execute.

Priority DispatcherPriority

The dispatcher priority.

SaveFileDialog(Control, params string[])

Shows a save file dialog.

public static Task<string> SaveFileDialog(Control Caller, params string[] Extensions)

Parameters

Caller Control

The caller control.

Extensions string[]

The allowed file extensions.

Returns

Task<string>

The selected file path, if any; otherwise, null.

ShowWaitCursor(Action, Control)

Executes an action while showing the wait cursor.

public static void ShowWaitCursor(Action Proc, Control Caller = null)

Parameters

Proc Action

The action to execute.

Caller Control

The caller control.

ShowWaitCursor<T>(Action<T>, T, Control)

Executes an action while showing the wait cursor.

public static void ShowWaitCursor<T>(Action<T> Proc, T Info, Control Caller = null)

Parameters

Proc Action<T>

The action to execute.

Info T

The action argument.

Caller Control

The caller control.

Type Parameters

T

The action argument type.