Check out the latest Tips & Tricks

Thursday, 29 October 2015

Author: Bo Andersen

Product News

In this episode of Tips & Tricks we take a closer look at exporting plug-ins and the Drag'n'drop enabled MIP plugin.

Exporting plug-ins

These instructions suddenly came into focus as a bug was discovered and fixed, with the renewed attention I would like share information on how to make exportable Smart Client plug-ins.

A Smart Client plugin will consist of two files or more. In the simplest scenario, two files:

  • one file will be a plugin.def file, containing information for the Smart Client to load the plugin and;
  • another file, which is a dll, containing the functionality

Plugin.def will contain:

  <file name="xxx.dll"/>   
  <load env="SmartClient"/>

If using a 32-bit Smart Client, the two files can be found on:

 C:\Program Files (x86)\Milestone\MIPPlugins\xxx (xxx being a folder name – any name is good)
 C:\Program Files (x86)\Milestone\MIPPlugins\xxx\Plugin.def
 C:\Program Files (x86)\Milestone\MIPPlugins\xxx\xxx.dll

If using a 64-bit Smart Client, the two files will on:

 C:\Program Files\Milestone\MIPPlugins\xxx (xxx being a folder name – any name is good)
 C:\Program Files\Milestone\MIPPlugins\xxx\Plugin.def
 C:\Program Files\Milestone\MIPPlugins\xxx\xxx.dll

In order to export the plugin with the SmartClient player, the plugin must be developed with an ExportManager class and within this class an override function –

public override bool IncludePluginFilesInExport              
                     get { return true; }              

This means that users can export the view with the plugin and the plugin will still run when executing the exported Smart Client Player!

Note: An exported Smart Client player is always a 32-bit Smart Client. If the plugin is not just the “AnyCPU”dll, but also a dll that is either 32 or 64 bit, you must take care.

For the 64 bit installation, you must add an extra folder for the 32 bit dlls and the files must be placed like this –

 C:\Program Files\Milestone\MIPPlugins\xxx\plugin.def
 C:\Program Files\Milestone\MIPPlugins\xxx\xxxcpp.dll (64bit dll)
 C:\Program Files\Milestone\MIPPlugins\xxx\xxx.dll
 C:\Program Files\Milestone\MIPPlugins\xxx\x86\xxxcpp.dll (32bit dll)
 C:\Program Files\Milestone\MIPPlugins\xxx\x86\xxx.dll

Note that a bug was discovered in this functionality which means you must use Smart Client 2016!


Drag'n'drop enabled MIP plugin

Drag'n'drop has so far been limited to dragging cameras into views. With the 2016 version of the SDK, you can now utilize drag'n'drop with MIP plugins as well. This sample shows how to enable dropping cameras onto your MIP plugin. To demonstrate, the existing sample "RGBEnhanceVideo" has been chosen and extended. Note that the title bar has been chosen for Drag'ndrop, not the actual video area:  

  1. How to implement drag'n'drop

1. Enable dropping on the control where you want to drop off a camera (property AllowDrop).

2. Define two event handlers for your control: OnDragEnter (preparing the actual drop when the cursor enters the drop area) and OnDragDrop (handling the actual drop).

3. Define an (empty) class VideoOS.RemoteClient.Application.DragDrop.DraggedDeviceIdList. This is necessary because the event data of the DragEnter and DragDrop events are of this type, and without having the right data type, you cannot extract the GUID of the dragged camera.

The code essentials

void pictureBox_OnDragEnter(object sender, System.Windows.Forms.DragEventArgs e)
 string[ ] szDragDataFormats = e.Data.GetFormats();  
 // only allow drop if the dragged item is a camera list  

 if (szDragDataFormats[0] == "VideoOS.RemoteClient.Application.DragDrop.DraggedDeviceIdList")  
    // retrieve the GUID of the dragged camera   

    List<Guid> myCameraList = (List<Guid>)e.Data.GetData(szDragDataFormats[0]);   
    myCameraGuid = myCameraList[0];     
    // allow the Windows drop event to fire

    e.Effect = DragDropEffects.All;  

void pictureBox_OnDrop(object sender, DragEventArgs e)
Item myDraggedCamera = new Item();  
myDraggedCamera = Configuration.Instance.GetItem (myCameraGuid, Kind.Camera);  _viewItemManager.SelectedCamera = myDraggedCamera;


Download the full document on Exporting plug-ins

Download the full document on Drag'n'drop enabled MIP plugin

Visit our SDK Support forum you need a MyMilstone log-in to access, if you don´t have one, or need help contact