Problem defining the plugin in Definition class

Hi, I don’t have an admin folder in my project and I defined these classes in the Definition.cs, but the Manufacturer and Version is displayed in the about section in the Management Client application ,although I checked EnvironmentType in Init function just for SmartClient. Because I need just load in the SmartClient.

What’s wrong here?

using System;
 
using System.Collections.Generic;
 
using System.Collections.ObjectModel;
 
using System.Drawing;
 
using System.Reflection;
 
using System.Windows.Forms;
 
using CallHandler.Background;
 
using CallHandler.Client;
 
using VideoOS.Platform;
 
using VideoOS.Platform.Background;
 
using VideoOS.Platform.Client;
 
 
 
namespace CallHandler
 
{
 
  public class CallHandlerDefinition : PluginDefinition
 
  {
 
    private static Image _treeNodeImage;
 
    private static Image _topTreeNodeImage;
 
    private static CallHandlerBackgroundPlugin _backgroundPlugin;
 
    private static bool _isInitialized = false;
 
    private static readonly object _lock = new object();
 
 
 
 internal static Guid CallHandlerPluginId = new Guid("e81234af-89bc-4f2a-bc5b-cf1f7a0b9d6a");
 
 internal static Guid CallHandlerKind = new Guid("1a234fe6-bcde-4df2-9090-12abc3e4e567");
 
 internal static Guid CallHandlerSidePanel = new Guid("fd9b4c12-ab34-4ebf-9123-cf5e4e90d123");
 
 internal static Guid CallHandlerViewItemPlugin = new Guid("ba9c8d23-d456-47c8-90f7-6e3b1230f9a4");
 
 internal static Guid CallHandlerSettingsPanel = new Guid("cf4b134e-bc5a-4b9f-8a6d-1f7e8123c0f8");
 
 internal static Guid CallHandlerBackgroundPlugin = new Guid("f1e2d3c4-bc5f-4a9f-87d4-3c90ab5e123f");
 
 internal static Guid CallHandlerWorkSpacePluginId = new Guid("d7e2c3b4-0105-4d9f-bc56-7d9f1e23c8f9");
 
 internal static Guid CallHandlerWorkSpaceViewItemPluginId = new Guid("5c134d2f-5f12-4d8b-90d4-3b8123c9f6e5");
 
 internal static Guid CallHandlerToolsOptionsDialog = new Guid("711923ab-1235-4f12-b9f4-c3850f7d3b4f");
 
 internal static Guid MyCallHandlerId = new Guid("c3d5a124-1b23-4e9f-b9f7-484c5e9f7b23");
 
 
 
    private List<BackgroundPlugin> _backgroundPlugins = new List<BackgroundPlugin>();
 
    private Collection<SettingsPanelPlugin> _settingsPanelPlugins = new Collection<SettingsPanelPlugin>();
 
    private List<ViewItemPlugin> _viewItemPlugin = new List<ViewItemPlugin>();
 
    private List<SidePanelPlugin> _sidePanelPlugins = new List<SidePanelPlugin>();
 
    private List<WorkSpacePlugin> _workSpacePlugins = new List<WorkSpacePlugin>();
 
 
 
 
 
    static CallHandlerDefinition()
 
    {
 
      Assembly assembly = Assembly.GetExecutingAssembly();
 
      string name = assembly.GetName().Name;
 
 
 
      System.IO.Stream pluginStream = assembly.GetManifestResourceStream(name + ".Resources.CallHandler.bmp");
 
      if (pluginStream != null)
 
        _treeNodeImage = System.Drawing.Image.FromStream(pluginStream);
 
    }
 
 
 
    internal static Image TreeNodeImage
 
    {
 
      get { return _treeNodeImage; }
 
    }
 
 
 
 
 
    public override void Init()
 
    {
 
      try
 
      {
 
        if (EnvironmentManager.Instance.EnvironmentType != EnvironmentType.SmartClient)
 
        {
 
          return;
 
        }         
 
         
 
        _topTreeNodeImage = VideoOS.Platform.UI.Util.ImageList.Images[VideoOS.Platform.UI.Util.PluginIx];
 
 
 
        if (EnvironmentManager.Instance.EnvironmentType == EnvironmentType.SmartClient)
 
        {
 
          _workSpacePlugins.Add(new CallHandlerWorkSpacePlugin());
 
          _viewItemPlugin.Add(new CallHandlerWorkSpaceViewItemPlugin());
 
          _settingsPanelPlugins.Add(new CallHandlerSettingsPanelPlugin());
 
          _backgroundPlugins.Add(new CallHandlerBackgroundPlugin());
 
        }
 
 
 
      }
 
      catch (Exception ex)
 
      {
 
        MessageBox.Show($"Error in CallHandlerDefinition Init: {ex.Message}");
 
      }
 
    }

Nothing is wrong in your plugin code.

When you deploy a plugin in

%PROGRAMFILES%\VideoOS\MIPPlugins

or

%PROGRAMFILES%\Milestone\MIPPlugins

the plugin will load in Smart Client, Management Client and Event Server whenever any of these starts.

The plugin will load even if there is no relevant class implementation for the environment. This means that even if you have made sure there is nothing for the Management Client in your plugin, your plugin will still load in the Management Client!

The way to avoid this, and control where the plugin loads, is to put a tag in the Plugin.def file.

Information from documentation.

https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/plug-in_development.html&tree=tree_search.html?search=plugin.def

-

The plugin.def file defines which DLL to load. This is done to avoid loading irrelevant DLLs.

The load element defines in which environments the plug-in should be loaded. If the load element is not present, the plug-in will be loaded in all applications.

The value of the attribute env contains the EnvironmentType enumerations as defined in the VideoOS.Platform.EnvironmentManager. Currently, these value are supported:

  • Administration
  • Client (same as SmartClient; Client is supported from Smart Client 2020 R3)
  • SmartClient
  • Standalone
  • Service

Thank you for your answer.

Im using Version 2023 R3

I added this, and it worked to load specifically in the Smart Client application: