Support Center

Implement

Low code implementation

Live Visualizer 3.0 has the capability of injecting custom model at different lifecycle stages by inheriting interface IVisualizerEvent

Below are the events in Visualizer Rendering Lifecycle:

  • ItemPreRender: Fires before the master template is rendered.
  • ItemPostRender: Fires after the master template is rendered.
  • DetailPreRender: Fires before the detail template is rendered.
  • DetailPostRender: Fires after the master template is rendered.
  • PagerPreRender: Fires before the pager template is rendered.
  • PagerPostRender: Fires after the pager template is rendered.
  • ItemBeforeGetModel: Fires before the master template model is generated.
  • DetailBeforeGetModel: Fires before the detail template model is rendered.

Example: How to add your custom data to model

public class VisualizerEventProcessor : IVisualizerEvent 

    { 

        public ActionResult onAction(VisualizerAction va) 

        { 

            ActionResult actionResult = new ActionResult(); 

            try 

            { 

                switch (va.Event) 

                { 

                    case VisualizerEventArgs.ItemPreRender: 

va.DataSource.Add("MyModel",Hi, I am Model); 

                        break; 

                    case VisualizerEventArgs.ItemPostRender: 

                        break; 

                    case VisualizerEventArgs.DetailPreRender: 

                        break; 

                    case VisualizerEventArgs.DetailPostRender: 

                        break; 

                    case VisualizerEventArgs.PagerPreRender: 

                        break; 

                    case VisualizerEventArgs.PagerPostRender: 

                        break; 

                    case VisualizerEventArgs.ItemBeforeGetModel: 

                        break; 

                    case VisualizerEventArgs.DetailBeforeGetModel: 

                        break; 

                    default: 

                        break; 

                } 

             catch (Exception ex) 

            { 

                actionResult.AddError("", "", ex); 

            } 

            return actionResult; 
     } 

} 

Live Visualizer 3.0 has the capability of modifying content submissions by inheriting interface ISubmissionEvent

Below are the events in content submission lifecycle:

  • AfterAddSubmission
  • AfterUpdateSubmission

Example: How to use these Submission events:

public class SubmissionEventProcessor : ISubmissionEvent 
    { 
        public ActionResult onAction(SubmissionEventArgs e, dynamic submission) 
        { 
            ActionResult actionResult = new ActionResult(); 

            if (submission != null) 
            { 
                if (e is SubmissionEventArgs.AfterAddSubmission) 
                { 
                    //Your code here 
                } 
                else if (e is SubmissionEventArgs.AfterUpdateSubmission) 
                { 
                    //Your code here 
                } 
            } 

            return actionResult; 
        } 
    } 

Glad we could be helpful. Thanks for the feedback.

Sorry we couldn't be helpful. Your feedback will help us improve this article.

How helpful was this page?

  
Updated on Tue, 21 Nov 2023 by Ashish Pachori

In this section