Text-Data From MyBackgroundPlugin To MyViewItemWpfUserControl A Wpf Control

What is the best practice to place text collected from MyBackgroundPlugin into a MyViewItemWpfUserControl A Wpf Control? I saw the Chat Sample mentioned to do something. Or is there some other way that is best?

  1. All I think I need is: How to Reference MyViewItemWpfUserControl from MyBackgroundPlugin.
  2. With that, does this method call need Invoke to avoid cross-threading?

Is this a good answer found in MIP-Docs?:

Home > Plug-in Integration > Architecture > Working with Messages ?

I think part of what you are searching for is how to reference something from one class in another class for a plugin running in the same process.

I find an example of that in the SCImageViewerAddOnSample.

In the PluginDefintion class of that sample I find:

public override void Init()
{
    // Populate all relevant lists with your plugins etc.
    if (EnvironmentManager.Instance.EnvironmentType == EnvironmentType.SmartClient)
    {
        var backgroundPlugin = new SCImageViewerAddOnSampleBackgroundPlugin();
        _sidePanelPlugins.Add(new SCImageViewerAddOnSampleSidePanelPlugin(backgroundPlugin));
        _backgroundPlugins.Add(backgroundPlugin);
    }
}

Done this way the SidePanelPlugin can reference the BackgroundPlugin. You can turn it the other way or you can make common properties in the definition. I hope you see the idea.

If the two classes are not in the same process, as an example the background is an Event Server. The idea of using message communication (transmitMessage) is good. For sharing values in the same process, I think it is overkill.

Note that if you get errors when updating the ViewItemWpfUserControl it might be because you are updating the UI and need to use the UI thread. If this is an issue, please lookup CallOnUiThread https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_client_control.html&tree=tree_search.html?search=callonuithread