Hi, I am currently creating a plugin that would show a camera window (via ShowCamerasInFloatingWindowCommand) when a link is click on a website which is in a Workspace that contains a ChromiumWebBrowser tag.
The link throws a Javascript command in which the plugin catches, but I get a STA error: “The calling thread must be STA, because many UI components require this.” in Milestone Xprotect Client. Here a some code snippets.
//this is in public partial class ProjectWorkSpaceViewItemWpfUserControl : ViewItemWpfUserControl
public ProjectWorkSpaceViewItemWpfUserControl()
{
InitializeComponent();
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
this.Browser.RegisterJsObject("metagrated", proxy);
}
//This is the Execution of the Javascript command.
public void Execute()
{
var data = new ShowCamerasInFloatingWindowData();
data.Cameras = new List<Item>() { cameraItem };
data.BrowseTime = DateTime.Now;
data.Mode = Mode.ClientPlayback;
EnvironmentManager.Instance.SendMessage(new Message(
MessageId.SmartClient.ShowCamerasInFloatingWindowCommand)
{
Data = data
});
}