Custom View Code
Anything created with the Custom View Auto-Code Designer is capable of having that design exported into actual c# code for you to add to your own .net library that can be loaded as an Add-In [see more] in LemonEdge.
Code
The Auto-Code designer will export the following:
- The definition of the view itself
- You can modify any part of this class
- The list of all controls in the view along with any custom behaviour/formatting.
- You can modify this control list
See our API-Code section for more information about using our API to create you own views and other UI components.
Example
As a simple example, continuing our Insurance Contract mock entity from the Custom Entity example [more info] we could create a simple view that holds the name, currency and description of our mock insurance contracts. The system would create the following code for us:
/*
Auto Generated file by LemonEdge © 2020
Warning: Any changes to this file will be overwritten if it is regenerated.
*/
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Text;
using LemonEdge.Entities;
using LemonEdge.API.Core;
using LemonEdge.API.Entities;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
using LemonEdge.Core;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Runtime.Serialization;
using LemonEdge.API.Attributes;
using LemonEdge.Client.Core.Views.Core;
namespace LemonEdge.Client.Views
{
public class ContractViewController : BaseDefaultSingleViewController
{
public ContractViewController(IBaseDefaultSingleView view) : base(view) { }
protected override IEnumerable ControlNames() =>
new ControlDisplayInfoLight[]
{
new ControlDisplayInfoLight(nameof(IInsuranceContract.Name), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Name", Format = "", Visible = true },
new ControlDisplayInfoLight(nameof(IInsuranceContract.CurrencyID), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Currency", Format = "", Visible = true },
new ControlDisplayInfoLight(nameof(IInsuranceContract.Description), editable: true) { Width = ControlDisplayInfo.DEFAULT_CONTROL_WIDTH_NORMAL, UserFriendlyColumnName = "Description", Format = "", Visible = true },
};
}
}
See our API-Code section for more information about using our API to create you own views and other UI components.