Class BaseUserInterfaceService
A standard implementation of the IUserInterfaceService user interface service.
public class BaseUserInterfaceService : IUserInterfaceService
- Inheritance
-
BaseUserInterfaceService
- Implements
- Inherited Members
- Extension Methods
Remarks
Applications can use this class to provide the basic user interface service implementation.
Constructors
BaseUserInterfaceService(string)
Initializes a new instance of the BaseUserInterfaceService class.
public BaseUserInterfaceService(string applicationName)
Parameters
applicationNamestringThe application name, for use in message box captions and error messages.
Remarks
MainWindow for Current will be assumed as the main window.
BaseUserInterfaceService(Window, string)
Initializes a new instance of the BaseUserInterfaceService class.
public BaseUserInterfaceService(Window mainWindow, string applicationName)
Parameters
mainWindowWindowThe main window.
applicationNamestringThe application name, for use in message box captions and error messages.
Properties
ActiveWindow
Gets the active window, which will either be the main application window or a nested modal dialog box window.
public 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.
public 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.
public 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.
public Window MainWindow { get; }
Property Value
Methods
SetMessageBoxFontSize(double)
Sets the message box font size.
public void SetMessageBoxFontSize(double fontSize)
Parameters
fontSizedoubleThe new font size.
ShowAboutBox()
Displays the standard Acuit Pinpoint application about box.
[Obsolete("This is deprecated and will be removed in a future version.")]
public void ShowAboutBox()
ShowAboutBox(string)
Displays the standard Acuit Pinpoint application about box.
[Obsolete("This is deprecated and will be removed in a future version.")]
public void ShowAboutBox(string additionalDescription)
Parameters
additionalDescriptionstringAdditional description text, that will appear in the dialog box below the assembly description.
ShowDialog(Window)
Displays a dialog box.
public bool ShowDialog(Window view)
Parameters
viewWindowThe window to use as the dialog box.
Returns
- bool
If the view implements IWithDialogResult, then its DialogResult value will be returned; otherwise, if the DataContext of
viewimplements IWithDialogResult, then its DialogResult value will be returned; otherwise, the result of ShowDialog() will be returned (returning false if it returns null).
ShowDialog(Window, object)
Displays a dialog box, using the supplied view model.
public bool ShowDialog(Window view, object viewModel)
Parameters
viewWindowThe window to use as the dialog box.
viewModelobjectThe object to use as the view model.
Returns
- bool
If the view implements IWithDialogResult, then its DialogResult value will be returned; otherwise, if the view model implements IWithDialogResult, then its DialogResult value will be returned; otherwise, the result of ShowDialog() will be returned (returning false if it returns null).
Remarks
The DataContext property of view will be set to viewModel.
ShowMessageBox(MessageBoxImage, string, params object[])
Displays a message box.
public MessageBoxResult ShowMessageBox(MessageBoxImage icon, string format, params object[] args)
Parameters
iconMessageBoxImageThe message box icon.
formatstringThe message text format string.
argsobject[]The message text arguments.
Returns
- MessageBoxResult
The message box result.
ShowMessageBox(MessageBoxImage, MessageBoxButton, string, params object[])
Displays a message box.
public MessageBoxResult ShowMessageBox(MessageBoxImage icon, MessageBoxButton button, string format, params object[] args)
Parameters
iconMessageBoxImageThe message box icon.
buttonMessageBoxButtonThe message box button(s) to show.
formatstringThe message text format string.
argsobject[]The message text arguments.
Returns
- MessageBoxResult
The message box result.
WaitCursor()
Gets a disposable object that shows a wait cursor and removes it when the object is disposed.
public IDisposable WaitCursor()
Returns
- IDisposable
A disposable object that shows and hides a wait cursor.