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.
Device
Gets the current device (computer, tablet, phone, etc.) displaying the application.
IDevice Device { get; }
Property Value
Methods
ExportServerDataAsync(ServerDataExportOptions)
Exports data from the server.
Task ExportServerDataAsync(ServerDataExportOptions options)
Parameters
options
ServerDataExportOptionsServer data export options.
Returns
- Task
Task.
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
TMainUIView
Type 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
TParentUIView
Type 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
maxSize
intMaximum allowed file size in bytes.
types
string[]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
types
string[]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
maxSize
intMaximum allowed file size in bytes.
types
string[]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
types
string[]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
exception
ExceptionThe 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
type
MessageTypeSeverity of the message.
title
stringMessage title.
text
stringMessage text.
buttons
MessageButton[]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.
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
type
MessageTypeSeverity of the message.
title
stringMessage title.
text
stringMessage text.
buttons
MessageButton[]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
type
MessageTypeSeverity of the message.
title
stringMessage title.
text
stringMessage text.
validateInput
Func<string, string>Function returning an error message to display near the input when the input value is invalid.
buttons
MessageButton[]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?)
Shows a toast.
void ShowToast(MessageType type, string? title, string text, int? duration = 3000, bool? dismissible = true)
Parameters
type
MessageTypeSeverity of the toast.
title
stringToast title.
text
stringToast text.
duration
int?Delay in milliseconds before automatically closing the toast.
dismissible
bool?Indicates whether the toast can be closed manually.