Interface IUserInterfaceService
- Namespace
- Acuit.Pinpoint.Workstation.Windows
- Assembly
- Acuit.Pinpoint.Workstation.Abstractions.dll
Provides user interface services.
public interface IUserInterfaceService
- Extension Methods
Properties
ActiveWindow
Gets the active window, which will either be the main application window or a nested modal dialog box window.
Window ActiveWindow { get; }
Property Value
Remarks
This returns the active window from the perspective of the application, irrespective of whether the application is activated (i.e., has focus). Any active message box has no effect on this property (though message boxes will by default use the window specified by this property as their parent window). A dialog box is currently being displayed if ActiveWindow does not equal MainWindow.
This will only be accurate if all dialogs and message boxes are invoked via the members of this interface.
IsDialogOrMessageBoxShown
Gets whether a modal dialog or message box is currently open.
bool IsDialogOrMessageBoxShown { get; }
Property Value
Remarks
This will only be accurate if all dialogs and message boxes are invoked via the members of this interface.
IsMessageBoxShown
Gets whether a message box is currently open.
bool IsMessageBoxShown { get; }
Property Value
Remarks
This will only be accurate if all dialogs and message boxes are invoked via the members of this interface.
MainWindow
Gets the main application window.
Window MainWindow { get; }
Property Value
Methods
GetKeypadInput(string, int?, bool)
Gets keypad input from the operator.
string? GetKeypadInput(string prompt, int? maxInputLength = null, bool isPasswordMode = false)
Parameters
promptstringThe prompt to display to the user in the keypad window.
maxInputLengthint?The maximum length, in characters, of the input value, or null or 0 to not limit the input length.
isPasswordModeboolWhether to use password mode, where characters typed are not displayed.
Returns
Exceptions
- ArgumentNullException
promptis null.- ArgumentOutOfRangeException
maxInputLengthis less than zero.
InvokeAutomationElementAsync(string)
Invokes an automation element.
Task<bool> InvokeAutomationElementAsync(string automationId)
Parameters
automationIdstringThe automation id of the element to invoke.
Returns
Remarks
Once the operation completes, the Result property on the returned task object contains true if the element was invoked, or false if no invokable element with the specified id was found.
Exceptions
- ArgumentNullException
automationIdis null.
PerformAsyncActionViaModalWindow<TResult>(Func<CancellationToken, Task<TResult>>, Action<AsyncActionWindow>?)
Performs an asynchronous action while displaying a modal "Please wait..." window. This provides a mechanism for executing asynchronous code from a synchronous context.
TResult PerformAsyncActionViaModalWindow<TResult>(Func<CancellationToken, Task<TResult>> action, Action<AsyncActionWindow>? configure = null)
Parameters
actionFunc<CancellationToken, Task<TResult>>A delegate for the method that performs the asynchronous action.
configureAction<AsyncActionWindow>An optional action to configure the modal window properties before it is shown.
Returns
- TResult
The value returned by the asynchronous action.
Type Parameters
TResultThe type of the result returned by the asynchronous action.
Remarks
If the asynchronous action completes synchronously, then the "Please wait..." window will not be shown.
Exceptions
- ArgumentNullException
actionis null.- Exception
An exception thrown by the asynchronous action. If the action canceled, this will be an OperationCanceledException or an exception derived from OperationCanceledException.
ShowDialog(Window, object?)
Displays a dialog box.
bool? ShowDialog(Window view, object? viewModel = null)
Parameters
viewWindowThe window to use as the dialog box.
viewModelobjectThe optional object to use as the view model. If this is not null, the DataContext property of
viewwill be set to this object.
Returns
- bool?
The result of DialogResult before the dialog closed.
Remarks
The view and/or the view model can implement IDialogAware to raise close requests, providing a value for
DialogResult. If viewModel is null, but the provided view has a value for
its DataContext property, that object will be used as the view model.
ShowDialog<TView>(object?, IServiceProvider?)
Displays a dialog box.
bool? ShowDialog<TView>(object? viewModel = null, IServiceProvider? serviceProvider = null) where TView : Window
Parameters
viewModelobjectThe optional object to use as the view model. If this is not null, the DataContext property of the created view will be set to this object.
serviceProviderIServiceProviderThe optional service provider to use for injecting dependencies. If this is null, the base Acuit Pinpoint Workstation service provider will be used (which will not include any services registered by any plug-ins).
Returns
- bool?
The result of DialogResult before the dialog closed.
Type Parameters
TViewThe view type to use as the dialog box window, which must derive from Window.
Remarks
This will create a new instance of TView, injecting dependencies into the constructor as needed. After the dialog is closed, if
the view implements IDisposable, it will be disposed.
ShowMessageBox(MessageBoxImage, MessageBoxButton, string)
Displays a message box.
MessageBoxResult ShowMessageBox(MessageBoxImage icon, MessageBoxButton button, string messageText)
Parameters
iconMessageBoxImageThe message box icon.
buttonMessageBoxButtonThe message box button(s) to show.
messageTextstringThe message text.
Returns
- MessageBoxResult
The message box result.
Exceptions
- ArgumentNullException
messageTextis null.
WaitCursor()
Gets a disposable object that shows a wait cursor and removes it when the object is disposed.
IDisposable WaitCursor()
Returns
- IDisposable
A disposable object that shows and hides a wait cursor.