Programmatically change workspace in SmartClient

Hi,

I would like to change the displayed workspace in the SmartClient based on received messages on a background plugin within the SmartClient. I have tried both the messages below but may not have set the parameters correctly and could not find an applicable example.

message = new VideoOS.Platform.Messaging.Message(VideoOS.Platform.Messaging.MessageId.SmartClient.ShowWorkSpaceCommand, null);

message.RelatedFQID = new FQID(EnvironmentManager.Instance.MasterSite.ServerId, FolderType.No,ClientControl.LiveBuildInWorkSpaceId);

EnvironmentManager.Instance.SendMessage(message, null, null);

and

messageData = Mode.ClientLive;

message= new VideoOS.Platform.Messaging.Message(VideoOS.Platform.Messaging.MessageId.SmartClient.ChangeModeCommand, messageData);

EnvironmentManager.Instance.SendMessage(message,null, null);

Please let me know the proper approach to programmatically change the displayed workspace in the SmartClient.

Thanks

After some more experimentation, I have found the below code switches the displayed workspace:

List wsps = ClientControl.Instance.GetWorkSpaceItems();

foreach (Item itm in wsps)

{

if (itm.Name.Contains(“Live”))

{

 message = new VideoOS.Platform.Messaging.Message(VideoOS.Platform.Messaging.MessageId.SmartClient.ShowWorkSpaceCommand, null);

 message.RelatedFQID = itm.FQID;

 ClientControl.Instance.CallOnUiThread(() => EnvironmentManager.Instance.SendMessage(message, null, null));

 break;

}

}

Thanks

Hi @John Moody​ ,

May I know if this is only available for plugin but not EnviromentType.Standalone?

I wanted to do the same thing:

Switching WorkSpace tabs on the Smart Client.

But my program failed to run the following statement:

List wsps = ClientControl.Instance.GetWorkSpaceItems();

I tried to try-and-catch the statement but no error was found and

the program terminate itself.

Or do I need to do some initialization things before I can call the

GetWorkSpaceItems() function?

Hope to hear from you, thanks.