PTMyView Customization Point

Creating a custom UI view to display in PlanetTogether using a customization

This guide will step through the process of coding a PTMyView Customization. If you are just getting started, you can learn about getting started with customizations.

Creating the Class

To create and load a custom view to display in PlanetTogether we need to create a new class that inherits from PTMyView. This customization class is located at: PTUserCustomization.PTMyView

Here is what a basic class should look like:

namespace PTUserInterfaceCustomization
{
/// <summary>
/// Inherit from PTMyView to implement MyViews member functions and properties
/// </summary>
public class MyView : PTMyView
{
//Empty constructor needed to add customization
public MyView() { }

//Create instance of custom control
private readonly TestControl m_control = new TestControl();

/// <summary>
/// Override Name property to display customization name
/// </summary>
public override string Name => " Custom My Views Control";

/// <summary>
/// Overrride Description property to display customization description
/// </summary>
public override string Description => "Shows custom view of custom data";

/// <summary>
/// Override TabCaption property to display View Caption
/// </summary>
public override string TabCaption => "Custom View";

/// <summary>
/// Override MyViewTransmissionFiredEvent to let UI know when a transmission has been fired
/// </summary>
public override event MyViewTransmissionHander MyViewTransmissionFiredEvent;

/// <summary>
/// Override this function to return custom control
/// </summary>
/// <returns></returns>
public override UserControl GetUserControl()
{
return m_control;
}

/// <summary>
/// Override Init function to initialize custom control and subscribe to events needed to update the control
/// </summary>
/// <param name="a_sd"></param>
/// <param name="a_eventListener"></param>
/// <param name="a_currentUser"></param>
public override void Init(ScenarioDetail a_sd, UICustomizationsLink a_eventListener, User a_currentUser)
{
//Subscribe to events and initialize control here
}
}
}

 

there are two functions for implementing PTMyView:

GetUserControl is used to return the instance of the custom MyViews control.

Init can be used to subscribe to events and initialize the custom control.

Let's take a look at the

parameters for Init.

  • ScenarioDetail a_sd: Via the various manager objects in this top level object, all other data objects can be accessed.
  • UICustomizationsLink a_eventListener: An event listener that can be used to subscribe to scheduler events such as: ScenarioOpened, ScheduleChanged, JobsSelectedInJobsPane, and GanttBlocksSelected.
  • User a_currentUser: The object containing information about the user operating PlanetTogether.

Next Steps

Explore the following articles to see an example of how this customization point can be used,  meet other types of scheduling requirements or to learn how to better navigate the PlanetTogether data objects explore the following articles:

 

Coming Soon...