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.
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.
Device
Gets the current device (computer, tablet, phone, etc.) displaying the application.
public IDevice Device { get; }
Property Value
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
options
ServerDataExportOptionsServer data export options.
Returns
- Task
Task.
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
TMainUIView
Type 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
TParentUIView
Type 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
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.
public 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.
public 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.
public 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.
public virtual void ShowError(Exception exception)
Parameters
exception
ExceptionThe 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
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.
public virtual 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.
public virtual 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.
public virtual 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.