Finding Other Behavior Controls

Similar to this tutorial's Example: Camera Control step, you can search for other controls added to the project workspace. There are several EZBManager.FormMain methods that make it easy. Additionally, there are a few EZBManager.FormMain events that allow your plugin to watch for added and removed controls. We'll discuss and provide examples of accessing other controls in the current project.

Control Add/Remove Events

EZBManager.FormMain.OnProjectLoadCompleted ()
This event is raised when a project has completed loading all controls to the workspace. This is a handy method if you're looking for a control when the project is loaded. This event will ensure all other behavior controls have loaded before raising. The event raised after a project has completely loaded all behavior controls. If your control is looking to bind to another control, find the control in this event. If you attempt to look for control (i.e., camera) during constructor or SetConfiguration, the other control may not have loaded from the config yet. This event is raised after all of the controls have been loaded into the workspace.

EZBManager.FormMain.OnBehaviorControlAdded(object newControl, int page)
The event is raised when a new control is added to the project workspace. The control and virtual desktop page will be returned. The event is raised when a control is added to the workspace. This could be during the project load event or if a user uses the Add Control menu. If you want to keep track of new controls added to the workspace, this is how to do it. However, if you're expecting a control to exist when a project is loaded, look into the OnProjectLoadCompleted event.

EZBManager.FormMain.OnBehaviorControlRemovedHandler(object removedControl)
The event is raised when an existing control is removed from the project workspace. This is not raised when the application is closing, or the project is closing. Contrary to OnBehaviorControlAdded, this event is raised when a user removes a control from the current workspace. The control is passed as a parameter, but it won't be closed until you release it from the completion of the event. This means don't expect the control to exist once your method attached to this event has been completed.

Find a Control

You may need to search the project for a specific control, perhaps bind to a camera frame event. This example will grab the first camera that it finds.

    void detach() {

      if (_cameraControl != null) {

        if (!_isClosing)
          ARC.Invokers.SetAppendText(tbLog, true, "Detaching from {0}", _cameraControl.Text);

        _cameraControl.Camera.OnNewFrame -= Camera_OnNewFrame;

        _cameraControl = null;

      if (!_isClosing)
        ARC.Invokers.SetText(btnAttach, "Attach");

    void attach() {


      Control [] cameras = ARC.EZBManager.FormMain.GetControlByType(typeof(ARC.UCForms.FormCameraDevice));

      if (cameras.Length == 0) {

        ARC.Invokers.SetAppendText(tbLog, true, "There are no camera controls in this project.");


      _cameraControl = (ARC.UCForms.FormCameraDevice)cameras[0];

      _cameraControl.Camera.OnNewFrame += Camera_OnNewFrame;

      ARC.Invokers.SetAppendText(tbLog, true, "Attached to: {0}", _cameraControl.Text);

      ARC.Invokers.SetText(btnAttach, "Detach");