GetCurrentWorkspaceRequest return null value

Hi, I want get current workspace and current time with my plugin:

  public partial class MyControl : ViewItemUserControl
    {
        private object _messageReceiverObject;
 
        public MyControl ()
        {
 
            InitializeComponent();
            _messageReceiverObject = EnvironmentManager.Instance.RegisterReceiver(new MessageReceiver(CurrentWorkSpaceEventHandler),
                                             new MessageIdFilter(MessageId.SmartClient.GetCurrentWorkspaceRequest));
....
        }
 
        private object CurrentWorkSpaceEventHandler(VideoOS.Platform.Messaging.Message message, FQID destination, FQID source)
        {
            if (InvokeRequired)
            {
                Invoke(new MessageReceiver(CurrentWorkSpaceEventHandler), message, destination, source);
            }
            else
            {
                  System.Diagnostics.Debug.WriteLine(message.Data);
            }
            return null;
        }
 
//and i send message in a timer tick
 private void timer1_Tick(object sender, EventArgs e)
        {
            EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(
                       MessageId.SmartClient.GetCurrentWorkspaceRequest
                      ), null);
        }
 
 

Message.Data is empty

I tryed with GetCurrentPlaybackTimeRequest but the message.Data is always null..

Can you help me?

Please remove Receiver (_messageReceiverObject) from your code. Instead, you will need to listen a message.

Luckily, there is a sample code in the AdminTabPlugin sample. Please see line 115, AdminTabCameraUserControl.cs, it says -

var answer = EnvironmentManager.Instance.SendMessage(new Message(MessageId.Control.PTZGetAbsoluteRequest), _associatedItem.FQID);

This is what you need to do in your sample code.