Hello,
I’m trying to open a floating window in playback mode with a given camera. My code looks like this approx:
var screenItems = Configuration.Instance.GetItemsByKind(Kind.Screen);
if (screenItems == null || !screenItems.Any())
{
return;
}
var windowItems = Configuration.Instance.GetItemsByKind(Kind.Window);
if (windowItems == null || !windowItems.Any())
{
return;
}
var cameraItem = ConfigAPIUtil.GetCameraWithMacOrId(cameraId);
if (cameraItem == null)
{
return;
}
var viewAndLayoutItem = GetOrCreateView(tabTitle, "1 x 1", 1, cameraItem.FQID.ObjectId);
var commandData = new MultiWindowCommandData
{
Screen = screenItems.First().FQID,
Window = windowItems.First().FQID,
View = viewAndLayoutItem.FQID,
MultiWindowCommand = MultiWindowCommand.OpenFloatingWindow,
PlaybackSupportedInFloatingWindow = true
};
try
{
var response = EnvironmentManager.Instance.SendMessage(new Message(MessageId.SmartClient.MultiWindowCommand, commandData));
var popupWindowFQID = (FQID)response[0];
EnvironmentManager.Instance.SendMessage(new Message(MessageId.SmartClient.ChangeModeCommand, clientMode), popupWindowFQID);
if (clientMode == Mode.ClientPlayback)
{
var thread = new Thread(() =>
{
Thread.Sleep(2000);
//ClientControl.Instance.CallOnUiThread(() =>
// EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.PlaybackCommand, new PlaybackCommandData() { Command = PlaybackData.PlayStop }))); // popupWindowFQID
var startDateTime = // Set up the start datetime
ClientControl.Instance.CallOnUiThread(() =>
EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.PlaybackCommand, new PlaybackCommandData() { Command = PlaybackData.Goto, DateTime = startDateTime }), popupWindowFQID));
});
thread.IsBackground = true;
thread.Start();
}
}
catch (Exception ex)
{
Logger.Log(ex);
}
The problem that I have is that the PlaybackCommand, the one with Command = PlaybackData.Goto does not seem to be executed, the time of the floating window that gets opened is the current desktop time, not the startDateTime value.
The ChangeModeCommand gets executed all right.
Thanks for your time.