Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to customize generated UI data objects
xomega
#1 Posted : Sunday, September 9, 2012 6:00:41 PM(UTC)
xomega



The UI data objects generated from the Xomega model are defined as partial classes, so that you could easily enhance them in separate files. This allows you to regenerate the data objects whenever the model changes without losing your manual customizations. Your enhancements may include adding your own additional data properties and child objects, adding validation logic or specifying any other presentation layer logic to support your screens.

Here are the steps you can take to customize the generated UI data objects.
  1. Add a new file that contains a partial class for your data object.
  2. Define any additional properties and/or child objects similar to the way they are being defined in the generated class.
  3. Override the OnInitialized method to create and configure your custom properties as well as to configure the data object and any of the generated properties.
  4. Specify any additional validation or other logic as required by your user interface.

Below is an example of customizing the generated ErrorLogObject data object by adding a new property that combines the values from two generated properties and displays them in a certain format.
Code:
using System;
using Xomega.Framework;
using Xomega.Framework.Properties;

namespace MyProject.Client.Objects
{
    public partial class ErrorLogObject
    {
        public const string ProcedureWithLine = "ProcedureWithLine";

        // A formatted combination of the error procedure and the error line properties.
        public ComboProperty ProcedureWithLineProperty { get; private set; }

        protected override void OnInitialized()
        {
            // Initialize and configure any additional custom properties
            // and perform other initialization tasks for the object.
            // The generated properties have been initialized and configured by this point.

            ProcedureWithLineProperty = new ComboProperty(this, ProcedureWithLine);
            ProcedureWithLineProperty.SetComponentProperties(ErrorProcedureProperty, ErrorLineProperty);
            ProcedureWithLineProperty.Format = "{0} [line: {1}]";
        }
    }
}
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.