Class App
Provides methods and properties to manage an application.
public class App : DisposableObject, IBaseObject, IDisposableObject, IDisposable
- Inheritance
-
App
- Implements
- Derived
Constructors
- App(IApplicationHandler?)
Initializes a new instance of the App class.
Fields
- BackendOS
Gets operating system as OperatingSystems enumeration.
- BuildCounter
Build counter for the test purposes.
- FastThreadExceptions
Gets or sets whether calls to and from native code are wrapped in "try catch".
- Handler
Gets application handler.
- InvariantEnglishUS
Gets invariant CultureInfo.
- Is64BitOS
Gets a value that indicates whether the current operating system is a 64-bit operating system.
- Is64BitProcess
Gets a value that indicates whether the current process is a 64-bit process.
- IsAndroidOS
Indicates whether the current application is running on Android.
- IsIOS
Indicates whether the current application is running on Apple iOS.
- IsLinuxOS
Returns true if operating system is Linux.
- IsMacOS
Returns true if operating system is Apple macOS.
- IsUnknownOS
Indicates whether the current application is running on unknown OS.
- IsWindowsOS
Returns true if operating system is Windows.
- LogUnhandledThreadException
Gets or sets whether to log unhandled thread exception.
- ThreadExceptionExitCode
Gets or sets application exit code used when application terminates due to unhandled exception.
Properties
- AppClassName
Gets or sets the application class name.
- DebugWriteLine
Gets or sets whether to call WriteLine(string) when Log(object?, LogItemKind) is called. Default is
false
.
- DefaultIcon
Gets or sets default icon for the application.
- DisplayName
Gets or sets the application display name.
- ExitOnFrameDelete
Allows the programmer to specify whether the application will exit when the top-level frame is deleted. Returns true if the application will exit when the top-level frame is deleted.
- HasApplication
Gets whether application was created and Current property is assigned.
- HasForms
Gets whether application has forms.
- InUixmlPreviewerMode
Gets whether application in Uixml previewer mode.
- Initialized
Gets whether application was initialized;
- IsActive
Gets whether the application is active, i.e. if one of its windows is currently in the foreground.
- IsBusyCursor
Returns true if between two BeginBusyCursor() and EndBusyCursor() calls.
- IsDebuggerAttached
Gets a value that indicates whether a debugger is attached to the process.
- IsMono
Indicates whether the current application is running on Mono runtime.
- IsRunning
Gets whether execution is inside the Run(Window) method.
- LangDirection
Gets the layout direction for the current locale or Default if it's unknown.
- LogFileIsEnabled
Gets or sets whether to write all log messages to file.
- LogFilePath
Gets or sets application log file path.
- MainWindow
Gets main window.
- Name
Gets or sets the application name.
- PlatformKind
Gets currently used platform.
- StartupPath
Gets the path for the executable file that started the application, not including the executable name.
- SupressDiagnostics
Allows to suppress some debug messages.
- Terminating
Gets whether Run(Window) method execution is finished.
- ThreadExceptionAssigned
Gets whether ThreadException event is assigned.
- UnhandledExceptionMode
Gets how the application responds to unhandled exceptions. Use SetUnhandledExceptionMode(UnhandledExceptionMode) to change this property.
- UnhandledExceptionModeIfDebugger
Gets how the application responds to unhandled exceptions (if debugger is attached). Use SetUnhandledExceptionModeIfDebugger(UnhandledExceptionMode) to change this property.
- UseBestVisual
Gets or sets whether application will use the best visual on systems that support different visuals.
- VendorDisplayName
Gets or sets the vendor display name.
- VendorName
Gets or sets the vendor name.
- VisibleWindows
Gets all visible windows in an application.
- Windows
Gets the instantiated windows in an application.
Methods
- AddIdleTask(Action?)
Adds
task
which will be executed one time when the application finished processing events and is about to enter the idle state.
- AddIdleTask(Action<object?>, object?)
Adds
task
which will be executed one time when the application finished processing events and is about to enter the idle state.
- Alert(object?)
Instructs the application to display a dialog with an optional
message
, and to wait until the user dismisses the dialog.
- BeginBusyCursor()
Changes the cursor to the given cursor for all windows in the application.
- DebugLog(object?)
Calls LogMessage event.
- DebugLogError(object?)
Logs error message.
- DebugLogIf(object?, bool)
Calls LogMessage event if
condition
istrue
.
- DebugLogReplace(object?, string?)
Calls LogMessage event to add or replace log message.
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- DoEvents()
Processes all messages currently in the message queue.
- DoInsideBusyCursor(Action)
Executes
action
between calls to BeginBusyCursor() and EndBusyCursor().
- EndBusyCursor()
Changes the cursor back to the original cursor, for all windows in the application.
- Exit()
Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed.
- ExitAndTerminate(int)
Calls Exit() and after that terminates this process and returns an exit code to the operating system.
- FirstWindow()
Returns first window or
null
if there are no windows.
- FirstWindow<T>()
Returns first window or
null
if there are no windows or window is not of theT
type.
- GetUnhandledExceptionMode()
Gets current unhandled exception mode.
- HandleThreadExceptions(Action)
Calls
action
inside try-catch block if specified by the exception handling settings FastThreadExceptions and GetUnhandledExceptionMode().
- HandleThreadExceptions<T>(Func<T>)
Calls
func
inside try-catch block if specified by the exception handling settings FastThreadExceptions and GetUnhandledExceptionMode().
- HasPendingEvents()
Checks whether there are any pending events in the queue.
- IdleLog(object?, LogItemKind)
Calls Log(object?, LogItemKind) method with
obj
parameter when application becomes idle.
- Invoke(Action?)
Executes the specified action on the thread that owns the application.
- Invoke(Delegate?)
Executes the specified delegate on the thread that owns the application.
- Invoke(Delegate, object?[])
Executes the specified delegate, on the thread that owns the application, with the specified list of arguments.
- InvokeIdle(Action?)
Executes action in the application idle state using Invoke(Action?).
- Log(object?, LogItemKind)
Calls LogMessage event.
- LogBeginSection(string?, LogItemKind)
Begins log section.
- LogBeginUpdate()
Can be called before massive outputs to log. Pairs with LogEndUpdate().
- LogEmptyLine()
Logs an empty string.
- LogEndSection(LogItemKind)
Ends log section.
- LogEndUpdate()
Must be called after massive outputs to log, if LogBeginUpdate() was previously called.
- LogError(object?)
Logs error message.
- LogErrorIf(object?, bool)
Calls LogError(object?) if
condition
istrue
.
- LogErrorIfDebug(object?)
Logs error message if DEBUG is defined.
- LogIf(object?, bool, LogItemKind)
Calls LogMessage event if
condition
istrue
.
- LogInUpdates()
Gets whether massive log outputs are performed and controls attached to log should not refresh.
- LogNameValue(object, object?, LogItemKind?, string?)
Logs name, value and hint as "{name} = {value} ({hint})".
- LogNameValueIf(string, object?, bool, LogItemKind)
Logs name and value pair as "{name} = {value}" if
condition
istrue
.
- LogNameValueReplace(object, object?, LogItemKind?)
Logs name and value as "{name} = {value}". If last logged item starts from "{name} = ", it is repaced with the new item.
- LogNativeMessage(string)
Calls Log(object?, LogItemKind) after calling BeforeNativeLogMessage event.
- LogReplace(object?, object?, LogItemKind)
Calls LogMessage event to add or replace log message.
- LogSection(Action, string?)
Logs section using LogBeginSection(string?, LogItemKind), LogEndSection(LogItemKind) and calling
logAction
between them.
- LogSeparator(LogItemKind)
Logs separator.
- LogWarning(object?)
Logs warning message.
- OnThreadException(Exception)
Handles exception showing ThreadExceptionWindow dialog and calling exception related events if specified in the exception handling settings.
- ProcessIdleTasks()
Runs idle tasks if they are present.
- ProcessLogQueue(bool)
Processes log queue.
- ProcessPendingEvents()
Processes all pending events.
- RaiseIdle()
Raises Idle event.
- Run(Window)
Starts an application UI event loop and makes the specified window visible. Begins running a UI event processing loop on the current thread.
- SetNativeTheme(string)
Allows runtime switching of the UI environment theme.
- SetSystemOption(string, int)
Sets system option value by name.
- SetUnhandledExceptionMode(UnhandledExceptionMode)
Instructs the application how to respond to unhandled exceptions.
- SetUnhandledExceptionModeIfDebugger(UnhandledExceptionMode)
Instructs the application how to respond to unhandled exceptions in debug mode.
- SetUnhandledExceptionModes(UnhandledExceptionMode)
Instructs the application how to respond to unhandled exceptions.
- SetUseBestVisual(bool, bool)
Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display.
- ShowExceptionWindow(Exception, string?, bool)
Shows ThreadExceptionWindow on the screen.
Events
- BeforeNativeLogMessage
Occurs before native debug message needs to be displayed.
- Idle
Occurs when the application finishes processing events and is about to enter the idle state.
- LogMessage
Occurs when debug message needs to be displayed.
- LogRefresh
Occurs when controls which display log messages need to be refreshed.
- ThreadException
Occurs when an untrapped thread exception is thrown.