Class ViewModel<TUIView>
- Namespace
- GroupeIsa.Neos.Designer.UIAbstractions
- Assembly
- GroupeIsa.Neos.Designer.UIAbstractions.dll
Represents the MVVM view model of an UI view.
[ExcludeFromCodeCoverage]
public abstract class ViewModel<TUIView> : BaseComponentViewModel, IViewModel<TUIView>, IViewModel, IBaseViewModel where TUIView : class, IUIView
Type Parameters
TUIViewThe type of UI view on which the view model is based.
- Inheritance
-
ViewModel<TUIView>
- Implements
-
IViewModel<TUIView>
- Derived
- Inherited Members
Properties
Actions
Gets the actions.
public IViewModelActions Actions { get; }
Property Value
AddingUIViewId
Gets or sets the id of the UI view that opens to add a new item.
public UIViewId? AddingUIViewId { get; set; }
Property Value
AddingUIViewName
Gets or sets the name of the UI view that opens to add a new item.
public string? AddingUIViewName { get; set; }
Property Value
ApiClient
Gets the API client.
public ApiClient ApiClient { get; }
Property Value
Behavior
Gets the behavior.
public IUIViewBehavior Behavior { get; }
Property Value
CanMoveNextPage
Gets a value indicating whether navigating to the next page is possible.
public bool CanMoveNextPage { get; }
Property Value
CanMoveNextPosition
Gets a value indicating whether the current position can be moved to the next item.
public bool CanMoveNextPosition { get; }
Property Value
CanMovePreviousPage
Gets a value indicating whether navigating to the previous page is possible.
public bool CanMovePreviousPage { get; }
Property Value
CanMovePreviousPosition
Gets a value indicating whether the current position can be moved to the previous item.
public bool CanMovePreviousPosition { get; }
Property Value
CreatedItems
Gets the new items of the datasource.
public IReadOnlyCollection<TUIView> CreatedItems { get; }
Property Value
- IReadOnlyCollection<TUIView>
CreationAllowed
Gets or sets a value indicating whether creating a new item is allowed.
public bool CreationAllowed { get; set; }
Property Value
CreationMode
Gets or sets a value indicating whether the view is in creation mode.
In creation mode, add item, clone item and refresh actions are disabled.
public bool CreationMode { get; set; }
Property Value
CurrentId
Gets or sets the current id.
public IIdValue? CurrentId { get; set; }
Property Value
DataSorts
Gets the collection of the sorts set on the datasource.
public IReadOnlyCollection<Sort> DataSorts { get; }
Property Value
Datafilter
Gets or sets the current data filter applied to the datasource.
public Filter Datafilter { get; set; }
Property Value
Datasource
Gets the datasource.
public IDatasource<TUIView> Datasource { get; }
Property Value
- IDatasource<TUIView>
DatasourceCurrent
Gets the item at the Position in the datasource.
Null when Position is -1 or greater than the position of the last item of the datasource.
Warning : not to be confused with the Item property of actions / event rules which designates the datasource item on which an action / event rule is triggered.
In most cases, you should use the Item property when available instead of DatasourceCurrent.
public TUIView? DatasourceCurrent { get; }
Property Value
- TUIView
Examples
The following example shows the access to the instance at the current position.
If the position is valid, the OrderedAt property of the instance is set to the current date.
if (DatasourceCurrent != null)
{
DatasourceCurrent.OrderedAt = DateTime.Now;
}
Description
Gets the description.
[Obsolete("Use the Title property instead.")]
public string Description { get; }
Property Value
EditingLinkPropertyName
Gets or sets the name of the property on which a link for editing the item is displayed.
public string? EditingLinkPropertyName { get; set; }
Property Value
EditingUIViewId
Gets or sets the id of the UI view that opens to edit an item.
public UIViewId? EditingUIViewId { get; set; }
Property Value
EditingUIViewName
Gets or sets the name of the UI view that opens to edit an item.
public string? EditingUIViewName { get; set; }
Property Value
EntityName
Gets the name of the entity.
public string? EntityName { get; }
Property Value
EntityViewDefaultSort
Gets the default sort of the entity view. null if the UI view is unbound.
public IReadOnlyCollection<Sort> EntityViewDefaultSort { get; }
Property Value
EntityViewName
Gets the name of the entity view.
public string? EntityViewName { get; }
Property Value
FilteringBehavior
Gets the filtering behavior.
public IFilteringBehavior FilteringBehavior { get; }
Property Value
GroupDescriptions
Gets the description of the groups made when grouping by a property.
public List<string> GroupDescriptions { get; }
Property Value
GroupingBehavior
Gets the grouping behavior.
public IGroupingBehavior GroupingBehavior { get; }
Property Value
HasChanges
Gets a value indicating whether the datasource has changes.
Modified items include both new and modified items. Relations and embedded collections (addition / deletion) are also taken into account recursively.
public bool HasChanges { get; }
Property Value
HasErrors
Gets a value indicating whether the datasource has errors.
Relations are also taken into account recursively.
public bool HasErrors { get; }
Property Value
HasMoreData
Gets a value indicating whether more data can be retrieved.
public bool HasMoreData { get; }
Property Value
Icon
Gets or sets the icon.
public string Icon { get; set; }
Property Value
IconId
Gets or sets the icon id.
public ImageId? IconId { get; set; }
Property Value
IsMain
Gets a value indicating whether the view model is the main view model.
public bool IsMain { get; }
Property Value
Loading
Gets a value indicating whether data is being loaded.
public bool Loading { get; }
Property Value
LookupContext
Gets the lookup context. Only defined when UI view is open in lookup modal.
public ILookupContext? LookupContext { get; }
Property Value
ModifiedItems
Gets the modified items of the datasource.
public IReadOnlyCollection<TUIView> ModifiedItems { get; }
Property Value
- IReadOnlyCollection<TUIView>
MonoRecord
Gets or sets a value indicating whether the UI view is in mono-record mode.
public bool MonoRecord { get; set; }
Property Value
NamedFilters
Gets the named filters.
public List<NamedFilter> NamedFilters { get; }
Property Value
PageNumber
Gets or sets the number of the current page in the paginated data source.
public int PageNumber { get; set; }
Property Value
PersistenceErrorItems
Gets the elements with at least one persistence error.
public IReadOnlyCollection<TUIView> PersistenceErrorItems { get; }
Property Value
- IReadOnlyCollection<TUIView>
Position
Gets or sets the current position in the datasource.
public int Position { get; set; }
Property Value
Examples
The following example shows how to set the position to the last element.
Position = Datasource.Count - 1;
Properties
Gets the properties.
public IViewModelProperties Properties { get; }
Property Value
RecordsByPage
Gets or sets the maximum number of records retrieved by page.
public int RecordsByPage { get; set; }
Property Value
Relations
Gets the relationships between the view model and the view models of the sub-views.
[Obsolete("Use Relationships instead.")]
public IReadOnlyCollection<IViewModelRelation> Relations { get; }
Property Value
Relationships
Gets the relationships between the view model and the view models of the sub-views.
public IReadOnlyCollection<IViewModelRelation> Relationships { get; }
Property Value
SelectedItems
Gets the selected items in the datasource.
public IReadOnlyCollection<TUIView> SelectedItems { get; }
Property Value
- IReadOnlyCollection<TUIView>
SortingBehavior
Gets the sorting behavior.
public ISortingBehavior SortingBehavior { get; }
Property Value
Title
Gets the title.
public string Title { get; }
Property Value
TotalRecordCount
Gets the total record count.
public int TotalRecordCount { get; }
Property Value
UIViewName
Gets the name of the UI view.
public string UIViewName { get; }
Property Value
UrlContext
Gets the URL context which contains additional parameters added to the URL.
public IUrlContext UrlContext { get; }
Property Value
UserStyleRules
Gets the user style rules.
public IUserStyleRule[] UserStyleRules { get; }
Property Value
ValidateLocalizableString
Gets or sets a value indicating whether the localizable strings with a missing translation generate an error / warning.
public bool ValidateLocalizableString { get; set; }
Property Value
ViewContext
Gets the view context which contains values shared between the UI view and its sub-views. Updates to the view context are applied on the UI view and all its sub-views.
When opening another UI view from the current UI view, the values of the current UI view are copied in the opened UI view. Updates to the current view context are not applied to opened UI view. Updates to the opened UI view are not applied to the current UI view.
public IViewContext ViewContext { get; }
Property Value
ViewModelId
Gets the view model identifier defined in the UI view template using the "id" attribute.
public string? ViewModelId { get; }
Property Value
Methods
AcceptChanges()
Accepts all the changes made to the datasource since data was loaded or the last time the AcceptChanges() or RejectChanges() was called.
public void AcceptChanges()
AddAsync(IEnumerable<TUIView>, bool)
Adds the specified items at the end of the datasource.
public Task<bool> AddAsync(IEnumerable<TUIView> items, bool asNewItem = false)
Parameters
itemsIEnumerable<TUIView>Items to add.
asNewItemboolA value indicating whether added items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been added,falseotherwise.
AddAsync(params TUIView[])
Adds the specified items at the end of the datasource.
public Task<bool> AddAsync(params TUIView[] items)
Parameters
itemsTUIView[]Items to add.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been added,falseotherwise.
Examples
The following example shows how to add an item to the data source.
Order item = new Order();
if (await AddAsync(item))
{
Console.WriteLine("Item added");
}
else
{
Console.WriteLine("Item not added");
}
AddNewAsync()
Creates a new item and adds it at the end of the datasource.
public Task<TUIView?> AddNewAsync()
Returns
- Task<TUIView>
A Task representing the asynchronous operation. The task result contains the new item or
nullif adding has been canceled.
Examples
The following example shows how to create and add a new item to the data source.
IOrder? item = await AddNewAsync();
ClearSort()
Clears the sorts set on the datasource.
public virtual void ClearSort()
CloneAsync(TUIView)
Creates a new item that is a copy of the specified source item and adds it at the end of the datasource.
public Task<TUIView?> CloneAsync(TUIView source)
Parameters
sourceTUIViewThe source item from which the new item will be cloned.
Returns
- Task<TUIView>
A Task representing the asynchronous operation. The task result contains the new item that is the result of the cloning operation or
nullif cloning has been canceled.
CloseAsync(bool, NavigationResult?)
Closes the current view.
public virtual Task CloseAsync(bool displayUnsavedChangesMessage = true, NavigationResult? result = null)
Parameters
displayUnsavedChangesMessageboolA value indicating whether the unsaved changes message is displayed.
resultNavigationResultThe navigation result.
Returns
ConvertFilterFromJsonAsync(string)
Converts a JSON string to a Filter object.
public Task<Filter> ConvertFilterFromJsonAsync(string json)
Parameters
jsonstringJSON.
Returns
CreateNewItem()
Creates a new item.
public TUIView CreateNewItem()
Returns
- TUIView
The created item.
Remarks
The item is not added to the datasource.
CreateServerDataExportOptions(string, ExportFormat)
Creates the server data export options from the current context.
public virtual ServerDataExportOptions CreateServerDataExportOptions(string fileName, ExportFormat format)
Parameters
fileNamestringThe file name.
formatExportFormatThe format.
Returns
- ServerDataExportOptions
The server data export options.
DeleteDataAsync(IEnumerable<TUIView>)
Removes the specified items from the server via an API call.
public virtual Task<bool> DeleteDataAsync(IEnumerable<TUIView> items)
Parameters
itemsIEnumerable<TUIView>Items to remove.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.
DeleteDataAsync(params TUIView[])
Removes the specified items from the server via an API call.
public virtual Task<bool> DeleteDataAsync(params TUIView[] items)
Parameters
itemsTUIView[]Items to remove.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.
DeleteSelectedItemsAsync()
Deletes the selected items.
public virtual Task<bool> DeleteSelectedItemsAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.
DisplayWaitingOverlayMessage(string)
Displays a waiting overlay message.
protected virtual void DisplayWaitingOverlayMessage(string message)
Parameters
messagestringThe message displayed in the overlay.
EnsureDataLoadedAsync()
Ensures data is loaded.
public virtual Task EnsureDataLoadedAsync()
Returns
Remarks
This method should be used exclusively for sub-view models that are not configured for automatic loading.
EnsureDataLoadedAsync(IDatasource<TUIView>)
Ensures data is loaded.
public virtual Task EnsureDataLoadedAsync(IDatasource<TUIView> datasource)
Parameters
datasourceIDatasource<TUIView>The datasource to ensure data is loaded for.
Returns
Remarks
This method should be used exclusively for sub-view models that are not configured for automatic loading.
ExecuteRemoveActionAsync()
Executes the Remove action.
public virtual Task ExecuteRemoveActionAsync()
Returns
- Task
A Task representing the asynchronous operation. The task result contains a value indicating whether the items have been removed.
ExecuteReportAsync(ReportId, Filter?, Dictionary<string, object>?)
Executes a report.
public virtual Task ExecuteReportAsync(ReportId reportId, Filter? filter = null, Dictionary<string, object>? parameters = null)
Parameters
reportIdReportIdReport id.
filterFilterFilter to apply to the data.
parametersDictionary<string, object>Parameters to pass to the report.
Returns
ExecuteReportAsync(string, Filter?, Dictionary<string, object>?)
Executes a report.
[Obsolete("Using string literals for report name is error-prone. Use new ExecuteReportOptions(Reports.MyReport) to benefit from compile-time safety.", false)]
public virtual Task ExecuteReportAsync(string reportName, Filter? filter = null, Dictionary<string, object>? parameters = null)
Parameters
reportNamestringReport name.
filterFilterFilter to apply to the data.
parametersDictionary<string, object>Parameters to pass to the report.
Returns
ExecuteReportWithOptionsAsync(ExecuteReportOptions)
Executes a report.
public virtual Task ExecuteReportWithOptionsAsync(ExecuteReportOptions options)
Parameters
optionsExecuteReportOptionsOptions.
Returns
FilterDataAsync()
Filters the data based on the current filter.
public virtual Task FilterDataAsync()
Returns
FilterDataAsync(Filter)
Filters the data based on the specified filter.
public virtual Task FilterDataAsync(Filter filter)
Parameters
filterFilterThe filter to apply.
Returns
FindSort(string)
Finds the sort set on the specified property.
public virtual Sort? FindSort(string propertyName)
Parameters
propertyNamestringThe property name.
Returns
- Sort
The sort found set on the specified property; otherwise
null.
FindSortIndex(string)
Find the index of the sort set on the specified property within DataSorts.
public virtual int FindSortIndex(string propertyName)
Parameters
propertyNamestringThe property name.
Returns
- int
The index of the sort set on the specified property; otherwise
-1.
FindSubViewModel<T>(string)
Gets the view model of the sub-view associated to the specified relation property.
public virtual ViewModel<T>? FindSubViewModel<T>(string relationPropertyName) where T : class, IUIView
Parameters
relationPropertyNamestringThe relation property name.
Returns
- ViewModel<T>
The view model of the sub-view or
nullif it does not exist.
Type Parameters
TType of the sub-view managed by the sub-view view model.
Remarks
The search based on the relation property name is not case sensitive.
FindViewModelById<T>(string)
Finds a view model by identifier.
public virtual ViewModel<T>? FindViewModelById<T>(string id) where T : class, IUIView
Parameters
idstringThe identifier.
Returns
- ViewModel<T>
The view model or
nullif it does not exist.
Type Parameters
TType of UI view managed by the view model.
FindViewModelOfViewContainer<TContainerUIView>(string)
Finds the view model of a view container in the current UI view corresponding to the specified container identifier.
public virtual ViewModel<TContainerUIView>? FindViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView
Parameters
containerIdstringThe container identifier.
Returns
- ViewModel<TContainerUIView>
The view model of the found view container or
nullwhen the view container was not found.
Type Parameters
TContainerUIViewThe type of the UI view loaded in the view container.
GetAction(string)
Gets the view model of the specified action.
public virtual IViewModelAction GetAction(string name)
Parameters
namestringThe action name.
Returns
- IViewModelAction
The view model of the action.
Exceptions
- Exception
The action does not exist.
GetCloningAllowed(TUIView)
Gets a value indicating whether cloning an item is allowed.
public bool GetCloningAllowed(TUIView item)
Parameters
itemTUIViewItem on which the
CloningAllowedvalue must be checked.
Returns
- bool
trueif the item can be cloned; otherwise,false.
GetDeletionAllowed(TUIView)
Gets a value indicating whether deleting an item is allowed.
public bool GetDeletionAllowed(TUIView item)
Parameters
itemTUIViewItem on which the
DeletionAllowedvalue must be checked.
Returns
- bool
trueif the item can be deleted; otherwise,false.
GetDisplayableProperties()
Gets the displayable properties.
public IReadOnlyCollection<IViewModelProperty> GetDisplayableProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The displayable properties.
GetEntityViewParameters()
Gets the entity view parameters.
public IViewModelEntityViewParameter<object?>[] GetEntityViewParameters()
Returns
- IViewModelEntityViewParameter<object>[]
The entity view parameters.
GetFilterableProperties()
Gets the filterable properties.
public IReadOnlyCollection<IViewModelProperty> GetFilterableProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The properties.
GetFullDatasource()
Gets the original datasource when the UI view datasource comes from a computed source.
When a parent UI view displays in its template the current UI view, it can provide a computed source. This source can contain different items from the ones that should originally be included in the datasource. This is typically used to provide a filtered datasource to a sub-view.
GetFullDatasource() gets the original datasource instead on the one from the computed source.
public IDatasource<TUIView> GetFullDatasource()
Returns
- IDatasource<TUIView>
The original datasource.
Remarks
If the datasource does not come from a computed source, GetFullDatasource() return the same value as Datasource.
GetOwnerFrame()
Gets the owner frame of this UI view.
public IFrame? GetOwnerFrame()
Returns
- IFrame
The owner frame or
nullif this UI view does not belong to a frame.
GetParentItem<TParentUIView>()
Gets the parent item that this data source is in relation with.
public TParentUIView? GetParentItem<TParentUIView>() where TParentUIView : class, IUIView
Returns
- TParentUIView
Parent item or
nullwhen this data source does not belong to a relationship.
Type Parameters
TParentUIViewType of the parent item.
Examples
The following example shows how to affect a 10% discount when adding an order line in an order placed on a Monday.
if (GetParentItem<Order>()?.OrderedAt.DayOfWeek == System.DayOfWeek.Monday)
{
Item.Discount = 0.1M;
}
GetPermissions()
Gets the current permissions.
public Permissions GetPermissions()
Returns
- Permissions
The permissions.
GetProperties()
Gets the properties.
public IReadOnlyCollection<IViewModelProperty> GetProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The properties.
GetProperty(string)
Gets the view model of the specified property.
public virtual IViewModelProperty GetProperty(string name)
Parameters
namestringThe property name.
Returns
- IViewModelProperty
The view model of the property.
Exceptions
- Exception
The property does not exist.
GetSubViewModel<T>(string)
Gets the view model of the sub-view associated to the specified relation property.
public virtual ViewModel<T> GetSubViewModel<T>(string relationPropertyName) where T : class, IUIView
Parameters
relationPropertyNamestringThe relation property name.
Returns
- ViewModel<T>
The view model of the sub-view.
Type Parameters
TType of the sub-view managed by the sub-view view model.
Remarks
The search based on the relation property name is not case sensitive.
Exceptions
- Exception
The sub-view view model does not exist.
GetUpdateAllowed(TUIView)
Gets a value indicating whether updating an item is allowed.
public bool GetUpdateAllowed(TUIView item)
Parameters
itemTUIViewItem on which the
UpdateAllowedvalue must be checked.
Returns
- bool
trueif the item can be updated; otherwise,false.
GetViewModelById<T>(string)
Gets a view model by identifier.
public virtual ViewModel<T> GetViewModelById<T>(string id) where T : class, IUIView
Parameters
idstringThe identifier.
Returns
- ViewModel<T>
The view model.
Type Parameters
TType of UI view managed by the view model.
Exceptions
- Exception
The view model does not exist.
GetViewModelOfViewContainer<TContainerUIView>(string)
Gets the view model of a view container in the current UIView by the specified container identifier.
public virtual ViewModel<TUIView> GetViewModelOfViewContainer<TContainerUIView>(string containerId) where TContainerUIView : class, IUIView
Parameters
containerIdstringThe container identifier.
Returns
- ViewModel<TUIView>
The view model of the founded view container.
Type Parameters
TContainerUIViewThe type of the uiview loaded in the view container.
GetVisibleProperties()
Gets the visible properties.
public IReadOnlyCollection<IViewModelProperty> GetVisibleProperties()
Returns
- IReadOnlyCollection<IViewModelProperty>
The visible properties.
HideWaitingOverlayMessage()
Hides the waiting overlay message.
protected virtual void HideWaitingOverlayMessage()
ImportAsync<TItem>(IEnumerable<TItem>, bool)
Imports the specified items at the end of the datasource.
public Task<bool> ImportAsync<TItem>(IEnumerable<TItem> items, bool asNewItem = false)
Parameters
itemsIEnumerable<TItem>Items to import.
asNewItemboolA value indicating whether imported items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the items have been imported,falseotherwise.
Type Parameters
TItemItem type (must contain same properties as IUIView).
ImportAsync<TItem>(params TItem[])
Imports the specified items at the end of the datasource.
public Task<bool> ImportAsync<TItem>(params TItem[] items)
Parameters
itemsTItem[]Items to import.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the item have been imported,falseotherwise.
Type Parameters
TItemItem type (must contain the same properties as IUIView).
Examples
The following example shows how to add an item to the data source.
Order item = new Order();
if (await AddAsync(item))
{
Console.WriteLine("Item added");
}
else
{
Console.WriteLine("Item not added");
}
InsertAsync(int, IEnumerable<TUIView>, bool)
Inserts the specified items at the specified position.
public Task<bool> InsertAsync(int position, IEnumerable<TUIView> items, bool asNewItem = false)
Parameters
positionintPosition.
itemsIEnumerable<TUIView>Items to insert.
asNewItemboolA value indicating whether inserted items should be considered new items.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the items have been inserted,falseotherwise.
InsertAsync(int, params TUIView[])
Inserts the specified items at the specified position.
public Task<bool> InsertAsync(int position, params TUIView[] items)
Parameters
positionintPosition.
itemsTUIView[]Items to insert.
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif items have been inserted,falseotherwise.
InsertNewAsync(int)
Creates a new item and inserts it at the specified position.
public Task<TUIView?> InsertNewAsync(int position)
Parameters
positionintPosition.
Returns
- Task<TUIView>
A Task representing the asynchronous operation. The task result contains the new item or
nullif inserting has been canceled.
InvokeWithWaitingOverlayAsync<T>(string, Func<Task<T>>)
Invokes an action and displays a overlay with the specified message during execution.
protected virtual Task<T> InvokeWithWaitingOverlayAsync<T>(string message, Func<Task<T>> func)
Parameters
messagestringThe message to display during execution.
funcFunc<Task<T>>The asynchronous action to invoke.
Returns
- Task<T>
A task that represents the asynchronous operation.
Type Parameters
TThe type of the action result.
IsSelected(TUIView)
Gets a value indicating whether the specified item is selected.
public virtual bool IsSelected(TUIView item)
Parameters
itemTUIViewThe item.
Returns
- bool
trueif the item is selected, otherwisefalse.
LoadDataAsync()
Loads data from the server via an API call.
public virtual Task LoadDataAsync()
Returns
LoadGroupSummariesAsync(IEnumerable<IViewModelProperty>, IEnumerable<SummaryRequest>)
Loads group summaries for the specified requests.
public virtual Task<IGroupSummaryResult[]> LoadGroupSummariesAsync(IEnumerable<IViewModelProperty> groupProperties, IEnumerable<SummaryRequest> requests)
Parameters
groupPropertiesIEnumerable<IViewModelProperty>Properties on which the summaries are grouped.
requestsIEnumerable<SummaryRequest>Requests for which to load summaries.
Returns
- Task<IGroupSummaryResult[]>
Result containing the loaded group summaries.
LoadMoreDataAsync()
Loads more data from the server via an API call.
public virtual Task LoadMoreDataAsync()
Returns
LoadMoreDataAsync(int)
Loads more data from the server via an API call.
public virtual Task LoadMoreDataAsync(int top)
Parameters
topintNumber of records to load.
Returns
LoadSummariesAsync(IEnumerable<SummaryRequest>)
Loads summaries for the specified requests.
public virtual Task<ISummaryResult> LoadSummariesAsync(IEnumerable<SummaryRequest> requests)
Parameters
requestsIEnumerable<SummaryRequest>Requests for which to load summaries.
Returns
- Task<ISummaryResult>
Result containing the loaded summaries.
MarkAsChanged()
Forces this instance to be marked as modified, regardless of whether any of its properties have actually changed.
public void MarkAsChanged()
Remarks
Once invoked, the HasChanges property will always return
true, signaling to the caller or underlying framework that the entity
should be treated as having pending modifications.
MoveToFirstPositionAsync()
Moves the current position to the first visible item in the grid, selects it and unselects the others.
public Task<bool> MoveToFirstPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToLastPositionAsync()
Moves the current position to the last visible item in the grid, selects it and unselects the others.
public Task<bool> MoveToLastPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToNextPositionAsync()
Moves the current position to the next visible item in the grid, selects it and unselects the others.
public Task<bool> MoveToNextPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
MoveToPreviousPositionAsync()
Moves the current position to the previous visible item in the grid, selects it and unselects the others.
public Task<bool> MoveToPreviousPositionAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The task result contains
trueif the position has changed,falseotherwise.
NavigateAsync(NavigationOptions)
Navigates to a UI view. It will call the Navigating event rule.
public Task NavigateAsync(NavigationOptions options)
Parameters
optionsNavigationOptionsNavigation options.
Returns
OnClosing(IUIClosingArgs)
Closing event rule.
protected virtual Task OnClosing(IUIClosingArgs arguments)
Parameters
argumentsIUIClosingArgsRule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnDataSaved(IUIDataSavedArgs<TUIView>)
Saved event rule.
protected virtual Task OnDataSaved(IUIDataSavedArgs<TUIView> arguments)
Parameters
argumentsIUIDataSavedArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnDataSaving(IUICancelRuleArguments)
Saving event rule.
protected virtual Task OnDataSaving(IUICancelRuleArguments arguments)
Parameters
argumentsIUICancelRuleArgumentsRule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnDisposed()
Disposed event rule.
protected virtual Task OnDisposed()
Returns
- Task
A task that represents the asynchronous operation.
OnInitialized()
Initialized event rule.
protected virtual Task OnInitialized()
Returns
- Task
A task that represents the asynchronous operation.
OnItemAdded(IUIItemAddedArgs<TUIView>)
Item added event rule.
protected virtual Task OnItemAdded(IUIItemAddedArgs<TUIView> arguments)
Parameters
argumentsIUIItemAddedArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemAdding(IUIItemAddingArgs<TUIView>)
Item adding event rule.
protected virtual Task OnItemAdding(IUIItemAddingArgs<TUIView> arguments)
Parameters
argumentsIUIItemAddingArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemCloning(IUIItemCloningArgs<TUIView>)
Item cloning event rule.
protected virtual Task OnItemCloning(IUIItemCloningArgs<TUIView> arguments)
Parameters
argumentsIUIItemCloningArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemRemoved(IUIItemRemovedArgs<TUIView>)
Item removed event rule.
protected virtual Task OnItemRemoved(IUIItemRemovedArgs<TUIView> arguments)
Parameters
argumentsIUIItemRemovedArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemRemoving(IUIItemRemovingArgs<TUIView>)
Item removing event rule.
protected virtual Task OnItemRemoving(IUIItemRemovingArgs<TUIView> arguments)
Parameters
argumentsIUIItemRemovingArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemSelectionChanged(IUIItemSelectionChangedArgs<TUIView>)
Item selection changed event rule.
protected virtual Task OnItemSelectionChanged(IUIItemSelectionChangedArgs<TUIView> arguments)
Parameters
argumentsIUIItemSelectionChangedArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnItemSelectionChanging(IUIItemSelectionChangingArgs<TUIView>)
Item selection changing event rule.
protected virtual Task OnItemSelectionChanging(IUIItemSelectionChangingArgs<TUIView> arguments)
Parameters
argumentsIUIItemSelectionChangingArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnNavigating(IUINavigatingArgs)
Navigating event rule.
protected virtual Task OnNavigating(IUINavigatingArgs arguments)
Parameters
argumentsIUINavigatingArgsRule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnPositionChanged()
Position changed event rule.
protected virtual Task OnPositionChanged()
Returns
- Task
A task that represents the asynchronous operation.
OnPositionChanging(IUIPositionChangingArgs)
Position changing event rule.
protected virtual Task OnPositionChanging(IUIPositionChangingArgs arguments)
Parameters
argumentsIUIPositionChangingArgsRule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnPropertyChanged<T>(IUIPropertyChangedArgs<TUIView, T>)
Property changed event rule.
protected virtual Task OnPropertyChanged<T>(IUIPropertyChangedArgs<TUIView, T> arguments)
Parameters
argumentsIUIPropertyChangedArgs<TUIView, T>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
Type Parameters
TThe type of the property that changed.
OnReferenceRetrieving(IUIReferenceRetrievingArgs<TUIView>)
ReferenceRetrieving event rule.
protected virtual Task OnReferenceRetrieving(IUIReferenceRetrievingArgs<TUIView> arguments)
Parameters
argumentsIUIReferenceRetrievingArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnRemoving(IUIRemovingArgs<TUIView>)
Items removing event rule.
protected virtual Task OnRemoving(IUIRemovingArgs<TUIView> arguments)
Parameters
argumentsIUIRemovingArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnRetrieved(IUIRetrievedArgs<TUIView>)
Retrieved event rule.
protected virtual Task OnRetrieved(IUIRetrievedArgs<TUIView> arguments)
Parameters
argumentsIUIRetrievedArgs<TUIView>Rule arguments.
Returns
- Task
A task that represents the asynchronous operation.
OnRetrieving(IUICancelRuleArguments)
Retrieving event rule.
protected virtual Task OnRetrieving(IUICancelRuleArguments arguments)
Parameters
argumentsIUICancelRuleArgumentsRule arguments.
Returns
- Task
A task that represents the asynchronous operation.
PromptSaveAsync()
Displays the save dialog if the view model has changes.
public virtual Task<bool> PromptSaveAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The result is a value indicating whether the saving operation has succeeded or was canceled by the user.
RejectChanges()
Rejects all the changes made to the datasource since data was loaded or the last time the AcceptChanges() or RejectChanges() was called.
public void RejectChanges()
ReloadDataAsync(IEnumerable<TUIView>)
Reloads the specified items from the server via an API call.
public virtual Task ReloadDataAsync(IEnumerable<TUIView> items)
Parameters
itemsIEnumerable<TUIView>Items to reload.
Returns
ReloadDataAsync(TUIView)
Reloads the specified item from the server via an API call.
public virtual Task ReloadDataAsync(TUIView item)
Parameters
itemTUIViewItem to reload.
Returns
RemoveSort(string)
Removes the sort set on the specified property.
public virtual void RemoveSort(string propertyName)
Parameters
propertyNamestringThe property name.
ReturnItemAsync(TUIView)
Return an item.
The frame containing the UI view is closed and the specified item is returned to the element that initiated the navigation.
protected virtual Task ReturnItemAsync(TUIView item)
Parameters
itemTUIViewThe item.
Returns
- Task
A task that represents the asynchronous operation.
ReturnItemsAsync(IEnumerable<TUIView>)
Return items.
The frame containing the UI view is closed and the specified items are returned to the element that initiated the navigation.
protected virtual Task ReturnItemsAsync(IEnumerable<TUIView> items)
Parameters
itemsIEnumerable<TUIView>The items.
Returns
- Task
A task that represents the asynchronous operation.
SaveDataAsync()
Persists the changed items on the server.
public virtual Task<bool> SaveDataAsync()
Returns
- Task<bool>
A Task representing the asynchronous operation. The result is a value indicating whether the saving operation has succeeded.
SelectAllItemsAsync()
Select all the items of the current datasource.
public virtual Task SelectAllItemsAsync()
Returns
SelectItemAsync(int)
Selects the item at the specified position in the datasource.
public virtual Task SelectItemAsync(int position)
Parameters
positionintThe position of the item to select.
Returns
SelectItemAsync(TUIView)
Selects the specified item of the datasource.
public virtual Task SelectItemAsync(TUIView item)
Parameters
itemTUIViewThe item to select.
Returns
SetCloningAllowed(bool)
Sets a value indicating whether cloning an item is allowed.
public void SetCloningAllowed(bool value)
Parameters
valueboolValue to set.
SetCurrentAndSelectAsync(TUIView)
Sets the current item, selects it and unselects the others.
public Task SetCurrentAndSelectAsync(TUIView item)
Parameters
itemTUIViewThe item to select.
Returns
SetDeletionAllowed(bool)
Sets a value indicating whether deleting an item is allowed.
public void SetDeletionAllowed(bool value)
Parameters
valueboolValue to set.
SetFilter(Filter)
Sets the filter to apply to the datasource.
public void SetFilter(Filter filter)
Parameters
filterFilterThe filter.
SetPositionAndSelectAsync(int)
Sets the position of the current item, selects it and unselects the others.
public Task SetPositionAndSelectAsync(int position)
Parameters
positionintThe position of the item to select.
Returns
SetSort(string, SortDirection)
Sets the sort on the specified property name.
public virtual void SetSort(string propertyName, SortDirection direction)
Parameters
propertyNamestringThe property name.
directionSortDirectionThe sort direction to set.
SetUpdateAllowed(bool)
Sets a value indicating whether updating an item is allowed.
public void SetUpdateAllowed(bool value)
Parameters
valueboolValue to set.
ShowApiError(IApiError)
Shows an API error.
public virtual Task ShowApiError(IApiError error)
Parameters
errorIApiErrorAPI error.
Returns
- Task
A task that represents the asynchronous operation.
ShowReportAsync(ShowReportOptions)
Shows a report.
public virtual Task ShowReportAsync(ShowReportOptions options)
Parameters
optionsShowReportOptionsOptions.
Returns
SortAsync()
Sorts the data in the datasource based on the sorts set in DataSorts.
When all data is loaded or when sorting an embedded sub-view model, sorting is done on the client side. Otherwise, sorting is done on the server side and sorted data is sent back to the client.
public virtual Task SortAsync()
Returns
UnmarkAsChanged()
Cancels this instance to be marked as modified.
public void UnmarkAsChanged()
Remarks
Once invoked, the HasChanges property will return false,
if there is no pending modifications, otheriwse it will return true.
UnselectAllItemsAsync()
Unselects all the items of the current datasource.
public virtual Task UnselectAllItemsAsync()
Returns
UnselectItemAsync(int)
Unselects the item at the specified position in the datasource.
public virtual Task UnselectItemAsync(int position)
Parameters
positionintThe position of the item to unselect.
Returns
UnselectItemAsync(TUIView)
Unselects the specified item of the datasource.
public virtual Task UnselectItemAsync(TUIView item)
Parameters
itemTUIViewThe item to unselect.
Returns
ValidateDataAsync()
Validates the modified items according to the input constraints and the validation rules.
public Task<bool> ValidateDataAsync()
Returns
ValidateDataAsync(bool)
Validates the data according to the input constraints and the validation rules.
public Task<bool> ValidateDataAsync(bool validateUnchangedItems)
Parameters
validateUnchangedItemsboolIf set to
true, validates all items including unchanged ones; otherwise, only modified items are validated.