Hello,
I’m using the MIP SDK 2020 R3.
I already know about https://developer.milestonesys.com/s/article/Drag-and-drop-enabled-MIP-plugin
I can’t find a way to enable drag and drop on a ImageViewerControl that is not yet connected:
private void Init()
{
_imageViewerControl.ClickEvent += this.OnClick;
_imageViewerControl.DoubleClickEvent += this.OnDoubleClick;
_imageViewerControl.DragDrop += this.OnDragDrop;
_imageViewerControl.DragEnter += this.OnDragEnter;
_imageViewerControl.Anchor = AnchorStyles.Top | AnchorStyles.Left;
_imageViewerControl.AllowDrop = true;
_imageViewerControl.EnableMouseControlledPtz = true;
_imageViewerControl.EnableMousePtzEmbeddedHandler = true;
_imageViewerControl.EnableDigitalZoom = true;
_imageViewerControl.EnableScrollWheel = true;
_imageViewerControl.EnableMiddleButtonClick = true;
_imageViewerControl.EnableVisibleCameraName = true;
_imageViewerControl.EnableVisibleHeader = true;
//_imageViewerControl.Initialize();
//_imageViewerControl.Connect();
//_imageViewerControl.ShowImageViewer = true;
}
private void OnDragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void OnDragDrop(object sender, DragEventArgs e)
{
var cameraGuidList = e.Data.GetData("VideoOS.RemoteClient.Application.DragDrop.DraggedDeviceIdList") as List<Guid>;
if (cameraGuidList != null && cameraGuidList.Any())
{
// do stuffs
}
else
{
MessageBox.Show("DragDrop: the only supported dragged content for this plugin is a camera");
}
}
As soon as I connect a camera (with Connect() and Initialize() by using a FQID etc), then I can drop on the ImageViewerControl and my code works.
I found a workaround by uncommenting the 3 lines (with Initialize() and Connect() and ShowImageViewer set to true) but that feels wrong
- What should I do to allow drag and drop on a unconnected ImageViewerControl? My goal is to mimick the behavior of a default view item as much as possible. I only wrote my own class so I could add overlays/widgets outside of the camera part (but still inside the view)
- I can enable things like “EnableMouseControlledPtz” or “EnableDigitalZoom”, but while it somewhat works there’s no display like for the default view where you have the arrows and the little home to reset the view. Should I draw these myself?