How to get a viewItems unique index or guid?

Standard view items are all saved and restored when a Smart client is rebooted. I need to do the same with my custom view items.

Lets say each viewItemPlugin I create needs a unique code that is the same after every reboot. How do I know which code to associate to each viewItem when the Smart Client restarts? I need to save the code somewhere but I don’t see anything unique about the viewItem.

Does each view item have a unique ID? Do they always load in the same order? Can I use the viewItems parent ID as a unique ID?

Thanks

The ViewItemManager contains the same ID when comparing it in the main window and in a floating window. I guess this answers to an extent what you cannot use.

I discussed with colleagues at the Milestone SDL team, but we were in doubt what you need. Can you tried to explain in other words what you do now, and what you want to achieve?

Hi Bo,

I managed to do want I wanted but there is a part 2 that I still nedd help with.

Basically, I am recovering cameras from another DVR and injecting them into the smart client with an RTSP nuget.

The trick is that the viewItems always load in the same order, so when the viewItemUserControl initializes, I use the WindowInformation.ViewAndLayoutItem.FQID.ObjectId and link it to an index that is incremented each time a viewItem loads.

So I now when I drag&drop a URL from my sidePanelPlugin into my view item, I can save the url to a index and guid so that next time the smart client opens, the view load up the same cameras.

The part I need help with is getting several cameras to display at high framerates inside my viewItems. My view item is simply a picturebox receiving frames from a plugin. I tried Accord.Video.FFMPEG and RtspClientSharp.

They work great for a single camera but when I try to put many inside a single view it take forever to load and the CPU and GPU at 1%.

Here is the code I use to display images. You guys are pros with this kind of stuff can you help me out? (frame.FrameSegment.Array is a byte[] containing a jpeg)

private void FrameReceived(object sender, RawFrame frame) {
if (InvokeRequired)
            {
                Invoke(new Action(() => FrameReceived(sender, frame)));
                return;
            }
 
Image image = Image.FromStream(new MemoryStream(frame.FrameSegment.Array));
            pictureBox_Image.Image?.Dispose();
            pictureBox_Image.Image = new Bitmap(image);
            image?.Dispose();
            pictureBox_Image.Refresh();
}

We are thinking you might be able to do more in the background thread, like create bitmap before you switch to the UI thread.

You might be able to get more help on stackoverflow, codeproject or another developer forum as this is not really specific Milestone stuff..