I want to do some processing on a still image captured when pressing the button for a ViewItemToolbarPluginInstance. This post is a question for my colleagues or community members with more experience in Smart Client plugins as well as an opportunity to share my challenge with the community.
When a toolbar plugin instance is initialized, it receives a “viewItemInstance” Item, and a “window” Item. I’m trying to figure out if I can use either of these to get access to the currently displayed still image.
Here’s what the viewItemInstance Item object looks like when serialized to json.
{
"FQID": {
"ServerId": {
"Type": "XPCO",
"Hostname": "artemis",
"Port": 80,
"Id": "04718292-2686-4a56-811d-3d8217a4d5ff",
"Scheme": "http"
},
"ParentId": "8ee8bce3-e3d9-482c-9751-57c8a6646744",
"ObjectId": "935c595f-b052-4fa8-97cb-7543a02193dc",
"ObjectIdString": "0",
"FolderType": 0,
"Kind": "69b9a865-20b0-4ffd-85b7-b062fe54cd8c"
},
"Name": "My M3007 - Camera 1",
"HasChildren": 1,
"Icon": null,
"MapIconKey": "00000000-0000-0000-0000-000000000000",
"HasRelated": 1,
"Properties": {
"Index": "0",
"ViewItemId": "ce8eb517-c0cb-45e9-80b3-5adab41eb9a5",
"Builtin": "True",
"CameraId": "79623616-16aa-4a56-ba02-6b4c6096cf23",
"CurrentCameraId": "79623616-16aa-4a56-ba02-6b4c6096cf23",
"cameraid": "79623616-16aa-4a56-ba02-6b4c6096cf23",
"framerate": "0",
"imagequality": "100",
"lastknowncameradisplayname": "My M3007 - Camera 1",
"xml": "<viewitem id=\"935c595f-b052-4fa8-97cb-7543a02193dc\" displayname=\"Camera ViewItem\" shortcut=\"\" type=\"VideoOS.RemoteClient.Application.Data.ContentTypes.CameraContentType.CameraViewItem, VideoOS.RemoteClient.Application\"><iteminfo cameraid=\"79623616-16aa-4a56-ba02-6b4c6096cf23\" lastknowncameradisplayname=\"My M3007 - Camera 1\" livestreamid=\"00000000-0000-0000-0000-000000000000\" imagequality=\"100\" framerate=\"0\" maintainimageaspectratio=\"True\" usedefaultdisplaysettings=\"True\" showtitlebar=\"True\" keepimagequalitywhenmaximized=\"False\" updateonmotiononly=\"False\" soundonmotion=\"0\" soundonevent=\"0\" smartsearchgridwidth=\"0\" smartsearchgridheight=\"0\" smartsearchgridmask=\"\" pointandclickmode=\"0\" usingproperties=\"True\" /><properties><property name=\"cameraid\" value=\"79623616-16aa-4a56-ba02-6b4c6096cf23\" /><property name=\"framerate\" value=\"0\" /><property name=\"imagequality\" value=\"100\" /><property name=\"lastknowncameradisplayname\" value=\"My M3007 - Camera 1\" /></properties></viewitem>"
},
"Enabled": true,
"PositioningInformation": null,
"Authorization": {},
"ContextMenu": []
}
And here’s what the window Item object looks like.
{
"FQID": {
"ServerId": {
"Type": "SC",
"Hostname": "localhost",
"Port": 80,
"Id": "00000000-0000-0000-0000-000000000000",
"Scheme": "http"
},
"ObjectId": "15da80d4-7595-431f-9866-674d2b80acc5",
"FolderType": 0,
"Kind": "15da80d4-7595-431f-9866-674d2b80acc5"
},
"Name": "Primary Display",
"HasChildren": 2,
"Icon": null,
"MapIconKey": "00000000-0000-0000-0000-000000000000",
"HasRelated": 2,
"Properties": {
"Location.X": "321",
"Location.Y": "142",
"Size.Width": "934",
"Size.Height": "759"
},
"Enabled": true,
"PositioningInformation": null,
"Authorization": {},
"ContextMenu": []
}
In the AnalyticsOverlay sample, it looks like a background plugin is subscribing to the ClientControl.Instance.NewImageViewerControlEvent in order to receive a reference to all the ImageViewerAddOn objects that get created.
I could do that, but then I need to manage a lot of references to objects I may never use. Is there a way to get a reference on demand, just to the ImageViewerAddOn object attached to the ViewItemInstance associated with the toolbar plugin instance that was activated?