Xamarin Forms and WindnTrees View Model
Abstract
In this tutorial we'll learn about WindnTrees ObserverObject view model data structure and its importance while working with Xamarin Forms.
In this tutorial we'll learn about WindnTrees ObserverObject view model data structure and its importance while working with Xamarin Forms.
WindnTrees view model (VM) consists of following major attribute categories and properties:
Data content categories include object and listing content and is defined by following property names:
"ObjectModel" and "ContentModel" deals in object data presentation and communication where as "ContentsListModel" deals in listing data.
"Selection Content" is a "ViewInput (WebInput, SearchInput)" reference class object that includes following fields and properties for retrieving appropriate records, a few are mentioned here as an example:
Server side controller de-serializes selection input using "WebInput" with enough class definition. Please read through WindnTrees.ICRUDS.Standard API library from invincibletec.com.
"Status Fields and Properties" are used by Xamarin Form's view for displaying processing status with related messages.
Controllers provide generalized data communication either of an entity type or a conceptual data class, in either way, we need to program view for data input. Xamarin Form's view uses BindingContext with different GUI controls for taking input and saves in WindnTrees "ContentModel" or "SearchInput" bound through generalized type properties. Input stored is then communicated between CRUDView(s) and CRUDController(s).
Data input models include:
By default ObserverObject based ViewModel include following commands with pre-defined implementations:
However, WindnTrees view model must be initialized with already defined commands for using with Xamarin Forms view.
CreateCommand invokes "create", ReadCommand invokes "read", UpdateCommand invokes "update", DeleteCommand invokes "delete" and ListCommand invokes "list" on server side CRUDController.
WindnTrees view model is WindnTrees.Abstraction controller actions response ready class component.
WindnTrees.Abstraction response CRUDL actions with following object response data set:
{ content: { } errors: {} }
Where content data object is reported in CRUDView.OnViewModel, CRUDView.OnContentObject and CRUDView.OnObjectViewModel events. WindnTrees.Abstraction response with following listing data set:
{ contents: [{},....,{}] errors: {} }
Where contents listing data is reported in CRUDView.OnViewModel, CRUDView.OnContentObjectList and CRUDView.OnListViewModel. CRUDMethod invocations are reported in CRUDView.OnViewModel and CRUDView.OnListViewModel where as all other CRUDView default CRUDL actions are reported in CRUDView.OnViewModel and CRUDView.OnContentObjectList.
WindnTrees view model is WindnTrees.Core controller actions response ready class component. WindnTrees.Core response CRUDL actions with following object response data set:
{ content: { } errors: {} }
Where content data object is reported in CRUDView.OnViewModel, CRUDView.OnContentObject and CRUDView.OnObjectViewModel events. WindnTrees.Core response with following listing data set:
{ contents: [{},....,{}] errors: {} }
Where contents listing data is reported in CRUDView.OnViewModel, CRUDView.OnContentObjectList and CRUDView.OnListViewModel. CRUDMethod invocations are reported in CRUDView.OnViewModel and CRUDView.OnListViewModel where as all other CRUDView default CRUDL actions are reported in CRUDView.OnViewModel and CRUDView.OnContentObjectList.
WindnTrees view model combines both object and listing data that fulfills the purpose of CRUDL communication. One view model fits both object and listing data management.