SmartClientMessageData - How can I know which ones are already showing?

My plugin asks the Smart Client to prompt a user to refresh it’s configuration. If I send this message 10 times, the message needs to be closed 10 times. How can check to see if the message is already displayed and only show a new one if there aren’t any there?

Alternative: How can I close all the opened messages with a specific ID before showing anew message?

Thank you.

I believe that you already see the sample SCMessageAreaMessageTester - https://doc.developer.milestonesys.com/html/index.html?base=samples/scmessageareamessagetester.html&tree=tree_search.html?search=scmessageareamessagetester

If you use the same GUID as messageID, then you don’t need to close every time. It is overwritten by the new message when you add the new message by Smart Client.

We changed code following in MessageModel.cs, can you please try to use this snippet?

public MessageModel() 
{ 
    //MessageId = new object(); 
    MessageId = new Guid("BD25714E-EB94-4FEA-AE3F-EA3BB3AA0F98"); 
    …  
} 

Hi Rie,

Thank you for your reply.

I am using a static GUID, the messages are not being replaced.

private readonly static string ButtonIdRefreshSmartClient = “b35f3bc5-6b6a-4626-8bc2-ba9eb020fda4”;

 SmartClientMessageData smartClientMessageData = new SmartClientMessageData()
                    {
                        IsClosable = true,
                        ButtonText = "Refresh",
                        Message = "Plugin has updated the configuration. Click refresh to see the new configuration.",
                        MessageId = ButtonIdRefreshSmartClient,
                        MessageType = SmartClientMessageDataType.Warning,
                        Priority = SmartClientMessageDataPriority.High,                           
                    };
                    EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.SmartClient.SmartClientMessageCommand, smartClientMessageData), null, null);

I could try the SCMessageAreaTester but I am pretty sure it would have the same result.

Do you see the same behavior when using the sample the way I suggested?

Sorry, I had a bug that was sending the message every second. *facepalm* very sorry to have wasted your time

Cheer up. Thank you for sharing your experience, it might help others to see how troubleshooting and debugging often reveals very unexpected causes.