Interface IBaseViewModel
- Namespace
- GroupeIsa.Neos.Designer.UIAbstractions
- Assembly
- GroupeIsa.Neos.Designer.UIAbstractions.dll
Provides the functionalities of the MVVM view model of a UI view or a UI component.
public interface IBaseViewModel
Properties
ContextData
Gets a container to store data.
IContextData ContextData { get; }
Property Value
Remarks
Context data can only be used in the code and cannot be bound in the template.
Methods
ExportServerDataAsync(ServerDataExportOptions)
Exports data from the server.
Task ExportServerDataAsync(ServerDataExportOptions options)
Parameters
optionsServerDataExportOptionsServer data export options.
Returns
- Task
Task.
FindEnum(string)
Finds an enumeration type by its name.
IEnumType? FindEnum(string enumName)
Parameters
enumNamestringName of the enumeration.
Returns
- IEnumType
The enumeration type if is has been found; otherwise
null.
GetEnum(string)
Gets an enumeration type by its name.
IEnumType GetEnum(string enumName)
Parameters
enumNamestringName of the enumeration.
Returns
- IEnumType
The enumeration type.
GetMainViewModel()
Gets the highest view model in the view.
ViewModel<IUIView> GetMainViewModel()
Returns
GetMainViewModel<TMainUIView>()
Gets the highest view model in the view.
ViewModel<TMainUIView> GetMainViewModel<TMainUIView>() where TMainUIView : class, IUIView
Returns
- ViewModel<TMainUIView>
Highest view model in the view.
Type Parameters
TMainUIViewType of UI view associated to the main view model.
GetParentViewModel()
Gets the parent view model.
ViewModel<IUIView>? GetParentViewModel()
Returns
GetParentViewModel<TParentUIView>()
Gets the parent view model.
ViewModel<TParentUIView>? GetParentViewModel<TParentUIView>() where TParentUIView : class, IUIView
Returns
- ViewModel<TParentUIView>
Parent view model.
Type Parameters
TParentUIViewType of UI view associated to the parent view model.
SelectDeferredFileAsync(int, params string[])
Selects a file to upload later.
Task<DeferredFileReference?> SelectDeferredFileAsync(int maxSize, params string[] types)
Parameters
maxSizeintMaximum allowed file size in bytes.
typesstring[]Accepted types. It can be a MIME type or a filename extension starting with a period character.
Returns
- Task<DeferredFileReference>
A reference to the selected file or null.
SelectDeferredFileAsync(params string[])
Selects a file to upload later.
Task<DeferredFileReference?> SelectDeferredFileAsync(params string[] types)
Parameters
typesstring[]Accepted types. It can be a MIME type or a filename extension starting with a period character.
Returns
- Task<DeferredFileReference>
A reference to the selected file or null.
SelectFileAsync(int, params string[])
Selects a file and immediately uploads it.
Task<FileReference?> SelectFileAsync(int maxSize, params string[] types)
Parameters
maxSizeintMaximum allowed file size in bytes.
typesstring[]Accepted types. It can be a MIME type or a filename extension starting with a period character.
Returns
- Task<FileReference>
A reference to the selected file or null.
SelectFileAsync(params string[])
Selects a file and immediately uploads it.
Task<FileReference?> SelectFileAsync(params string[] types)
Parameters
typesstring[]Accepted types. It can be a MIME type or a filename extension starting with a period character.
Returns
- Task<FileReference>
A reference to the selected file or null.
ShowError(Exception)
Shows a message displaying the specified exception.
void ShowError(Exception exception)
Parameters
exceptionExceptionThe exception to display.
ShowMessageAsync(MessageType, string, string, params MessageButton[])
Shows a message.
Task<IMessageResponse> ShowMessageAsync(MessageType type, string title, string text, params MessageButton[] buttons)
Parameters
typeMessageTypeSeverity of the message.
titlestringMessage title.
textstringMessage text.
buttonsMessageButton[]Buttons.
Returns
- Task<IMessageResponse>
A task that represents the asynchronous operation. The task result contains a IMessageResponse that contains the response.
Examples
The following example shows how to display a question and wait for the response.
// String literals here ("Question", "Are you ready?") are simplified for readability.
// Real rule/action/method code must use UIResources.[Module].[ResourceName] instead of hardcoded text.
IMessageResponse response = await ShowMessageAsync(MessageType.Info, "Question", "Are you ready?", new MessageButton(MessageButtonType.Yes, true), new MessageButton(MessageButtonType.No));
if (response.ButtonType == MessageButtonType.Yes)
{
Start();
}
ShowMessageWithInputAsync(MessageType, string, string, params MessageButton[])
Shows a message with an input.
Task<IMessageResponse> ShowMessageWithInputAsync(MessageType type, string title, string text, params MessageButton[] buttons)
Parameters
typeMessageTypeSeverity of the message.
titlestringMessage title.
textstringMessage text.
buttonsMessageButton[]Buttons.
Returns
- Task<IMessageResponse>
A task that represents the asynchronous operation. The task result contains a IMessageResponse that contains the response.
ShowMessageWithInputAsync(MessageType, string, string, Func<string?, string?>, params MessageButton[])
Shows a message with an input.
Task<IMessageResponse> ShowMessageWithInputAsync(MessageType type, string title, string text, Func<string?, string?> validateInput, params MessageButton[] buttons)
Parameters
typeMessageTypeSeverity of the message.
titlestringMessage title.
textstringMessage text.
validateInputFunc<string, string>Function returning an error message to display near the input when the input value is invalid.
buttonsMessageButton[]Buttons.
Returns
- Task<IMessageResponse>
A task that represents the asynchronous operation. The task result contains a IMessageResponse that contains the response.
ShowToast(MessageType, string?, string, int?, bool, params ToastButton[])
Shows a toast.
void ShowToast(MessageType type, string? title, string text, int? duration = 3000, bool dismissible = true, params ToastButton[] buttons)
Parameters
typeMessageTypeSeverity of the toast.
titlestringToast title.
textstringToast text.
durationint?Delay in milliseconds before automatically closing the toast.
dismissibleboolIndicates whether the toast can be closed manually.
buttonsToastButton[]Buttons to display in the toast.
ToggleOverlay(ToggleOverlayOptions)
Toggles an overlay (Modal, Popover).
void ToggleOverlay(ToggleOverlayOptions options)
Parameters
optionsToggleOverlayOptionsOptions.
ToggleOverlay(string)
Toggles an overlay (Modal, Popover).
void ToggleOverlay(string overlayId)
Parameters
overlayIdstringOverlay identifier.