Class BaseComponentViewModel
- Namespace
- GroupeIsa.Neos.Designer.UIAbstractions
- Assembly
- GroupeIsa.Neos.Designer.UIAbstractions.dll
Represents the MVVM view model of a UI view or UI component.
[ExcludeFromCodeCoverage]
[SuppressMessage("Minor Code Smell", "S3717:Track use of \"NotImplementedException\"", Justification = "This is an abstraction. It has no implementation by nature.")]
public abstract class BaseComponentViewModel : IBaseViewModel
- Inheritance
-
BaseComponentViewModel
- Implements
- Derived
-
ViewModel<TUIView>
- Inherited Members
Properties
ContextData
Gets a container to store data.
public IContextData ContextData { get; }
Property Value
Remarks
Context data can only be used in the code and cannot be bound in the template.
Logger
Gets the logger.
protected INeosLogger Logger { get; }
Property Value
Methods
ExportServerDataAsync(ServerDataExportOptions)
Exports data from the server.
public virtual Task ExportServerDataAsync(ServerDataExportOptions options)
Parameters
optionsServerDataExportOptionsServer data export options.
Returns
- Task
Task.
FindEnum(string)
Finds an enumeration type by its name.
public 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.
public IEnumType GetEnum(string enumName)
Parameters
enumNamestringName of the enumeration.
Returns
- IEnumType
The enumeration type.
GetMainViewModel()
Gets the highest view model in the view.
public ViewModel<IUIView> GetMainViewModel()
Returns
GetMainViewModel<TMainUIView>()
Gets the highest view model in the view.
public 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.
public ViewModel<IUIView>? GetParentViewModel()
Returns
GetParentViewModel<TParentUIView>()
Gets the parent view model.
public 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.
public 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.
public 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.
public 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.
public 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.
public virtual void ShowError(Exception exception)
Parameters
exceptionExceptionThe exception to display.
ShowMessageAsync(MessageType, string, string, params MessageButton[])
Shows a message.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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).
public void ToggleOverlay(ToggleOverlayOptions options)
Parameters
optionsToggleOverlayOptionsOptions.
ToggleOverlay(string)
Toggles an overlay (Modal, Popover).
public void ToggleOverlay(string overlayId)
Parameters
overlayIdstringOverlay identifier.