Services
In order to use the built-in desktop services, call the RegisterDesktopServices() extension method of IServiceCollection:
services.RegisterDesktopServices();
The ListViewModelFactory service makes it possible to populate a list of drop-down items from a collection, enumeration or class constants. It contains the following methods:
GetItems()— returns a list ofListItemViewModelobjects by retrieving the keys and names from the collection. An optional empty item, withnullkey and the specified name, can be also added.GetEnumItems()— returns a list ofListItemViewModelobjects representing the values and display names of the values of an enumeration type. It is similar to theGetEnumSelectList()method of theIHtmlHelperservice available in web applications. An optional empty item can also be added.GetConstItems()— returns a list ofListItemViewModelobjects representing the values of all constants defined in a class. It is similar to theGetConstSelectList()extension method of theIHtmlHelperservice (see MVC for more information). An optional empty item can also be added.
The LocalSettingsService service makes it possible to store local application settings in a JSON file. It contains the following methods:
Load()— loads the settings from the specified file and deserializes them into the specified class.Save()— serializes the settings into JSON and saves them to the specified file.
In development mode, the location of the setting files is relative to the application’s base directory. In production mode, this location is relative to the path created using the local application data directory for the current user and the application name.