I need to insert an existing View into a WPF control, can anyone please help me?
Many thanks,
Frediano
I need to insert an existing View into a WPF control, can anyone please help me?
Many thanks,
Frediano
Unfortunately it is not possible but there is a workaround.
You will need to read the view configuration yourself and manually populate a control. Regarding the control, this link might be helpful for you - https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_client_1_1_view_control.html&tree=tree_search.html?search=viewcontrol
Can you please tell us why do you want to insert an existing View into a WPF control? I mean, what do you want to achieve with it? Because we are wondering if there might be alternative ways, but we need to know about the reason why you want to do it.
Rie,
I’m developing a plugin to send specific layout to a Videowall system.
I’ll show the actual problem.
These are specific View (layout) for the videowall …
and this is the workspace dedicated to videowall I used ClientControl.Instance.GenerateViewControl(…) to insert the view in a WPF control (actually it is a Grid).This is after dragging&dropping camera from left …
and after double-click on a specific viewItemThe problem is that the View is not linked with Client because the selected ViewItem has not “Azure” border and plugin are non receiving any indication after registering for SelectedViewChangedIndication, SelectedViewItemChangedIndication, SelectedCameraChangedIndication, so even if we can ‘see’ camera plugin can’t know which camera are in which ViewItem
Many Thanks,
Frediano
We have an idea that you could subscribe to
abstract EventHandler<ViewControlItemArgs> VideoOS.Platform.Client.ViewControl.SelectedItemChanged, please see this -
It doesn’t work. This is my method:
public ViewControl CreateLayoutControl(Grid container)
{
List<ViewControlItem> viewControlItems = new List<ViewControlItem>();
int idx = 0;
foreach (var item in CurrentLayout.GetChildren())
{
viewControlItems.Add(new CustomViewControlItem(item.FQID.ObjectId, idx++));
}
// Creazione del Controllo
ViewControl control = ClientControl.Instance.GenerateViewControl(viewControlItems, CurrentLayout.Layout.ToList());
control.HorizontalAlignment = HorizontalAlignment.Stretch;
control.VerticalAlignment = VerticalAlignment.Stretch;
control.Name = CurrentLayout.Name.Replace(" ", "_");
// Abilita il Drop delle Telecamere
control.AllowDrop = true;
// Controllo in modalità Live
control.Live = true;
control.IsHitTestVisible = true;
// Evento di Drop della Telecamera
control.Drop += DropEventHandler;
// Evento di Cambio Selezione Vista
control.SelectedItemChanged += SelectedItemChangedEventHandler;
LayoutID = control.WindowId;
CurrentLayoutControl = control;
// Registra il Listener del Cambio Vista
object ViewChangedObj = EnvironmentManager.Instance.RegisterReceiver(SelectedViewChangedEventHandler, new MessageIdFilter(MessageId.SmartClient.SelectedViewChangedIndication));
object ViewItemChangedObj = EnvironmentManager.Instance.RegisterReceiver(SelectedViewItemChangedEventHandler, new MessageIdFilter(MessageId.SmartClient.SelectedViewItemChangedIndication));
object CameraChangedObj = EnvironmentManager.Instance.RegisterReceiver(SelectedCameraChangedEventHandler, new MessageIdFilter(MessageId.SmartClient.SelectedCameraChangedIndication));
container.Children.Clear();
container.Children.Add(CurrentLayoutControl);
return control;
}
None of the 4 listeners are ever activated
Many Thanks,
Frediano
Rie,
just few other infos:
Many Thanks,
Frediano
Sorry, Platform is 2021R1
Thank you for the additional information. For our understanding, we have a question.
Does “control.SelectedItemChanged” happen when you switch to your workspace but not while switching cameras on the workspace?
control.SelectedItemChanged never happens.
I made other test: if I switch to live/playback workspace the three registered listeners where fired with empty data message to notify plugin that are leaving camera, viewItem an view, then are fired whit data message containing view, viewItem and camera of new workspace; in this workspace changing the selected viewItem SelectedViewItemChange and SelectedCameraChange are fired.
Returning to dedicated workspace, after the messages related to previous wks appen that:
Many Thanks,
Frediano
Thank you for the additional information. Milestone Development has started an investigation.
Milestone Development fixed the issue and the fix will release in the 2022 R3.
Rie,
I made other interesting test that I want to show you.
When the plugin start create some specific View (Layout), in this case Tipe 1, 2 and 3. The Views can be used by plugin in dedicated workspace, this is Tipe 1.In order to keep the original view I make a copy by adding " WIP" to name.
Last but not least when I select dedicated workspace the View name returned by callback registered with SelectedViewChangedEventHandler is not “Tipe 1 WIP” but the name of View used to construct dedicated workspace (appearing on related tab).
Many Thanks,
Frediano
Can you please provide your plugin to reproduce the issue for further investigation?
Yes, I can. Let me remove all my client information, I signed an NDA.
You have also to know that I found a workaround to remove cameras from layout, I will left it in place.
Frediano
You can download both source and plugin folder from here: https://www.dropbox.com/s/tj3k9fan3zynk3o/XXX_HW.rar?dl=0
Please let me know when you download it, I will remove it.
Frediano
Thanks, we have download it.
We have the plugin now, and can’t figure out how to reproduce it. Could you please describe what the plugin should do and the steps to reproduce the problem you are facing?
Look at LayoutManager class, SelectedItemChanged was never fired while SelectedViewChangedEventHandler, SelectedViewItemChangedEventHandler and SelectedCameraChangedEventHandler where fired only if you switch to Line/Playback workspaces. Please read also emails with Rie.
Many Thanks,
Frediano
I think we are talking about a couple of things here. Let’s clarify the addressed problem again since it is hard to follow now because the thread grew bigger and topics have been changed in the conversation above. It is better to pose a separate question for each topic/issue.
The issue with “SelectedItemChanged” does not get fired. We have fixed it which will be released in 2022R3.
Now we are trying to reproduce the following issue:
“SelectedViewChangedEventHandler, SelectedViewItemChangedEventHandler and SelectedCameraChangedEventHandler where fired only if you switch to Live/Playback workspaces”.
Is it correct? or are we talking about a different issue?
The provided plugin does not act as you have explained in the screenshot. It should create 3 layouts but I don’t see them.
Could you please explain step by step how to reproduce it?