OSAE.Plugin.ActivatePlugin C# (CSharp) Метод

ActivatePlugin() публичный Метод

public ActivatePlugin ( ) : bool
Результат bool
        public bool ActivatePlugin()
        {
            Log = new OSAE.General.OSAELog(PluginName);
            try
            {
                Log.Info(PluginName + ":  Starting Plugin...");
                _plugin = (OSAEPluginBase)_domain.CreateInstanceAndUnwrap(_assemblyName, _assemblyType);
                _plugin.InitializeLifetimeService();
                _running = true;

                _domain.UnhandledException += Domain_UnhandledException;
                return true;
            }
            catch (Exception ex)
            {
                Log.Error("Error Starting Plugin (" + PluginName + ")", ex);
                _enabled = false;
                return false;
            }
        }

Usage Example

 private void startPlugin(Plugin plugin)
 {
     //OSAEObject obj = OSAEObjectManager.GetObjectByName(plugin.PluginName);
     //OSAEObjectManager.ObjectUpdate(plugin.PluginName, plugin.PluginName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, true);
     try
     {
         if (plugin.ActivatePlugin())
         {
             plugin.RunInterface(serviceObject);
             OSAEObjectStateManager.ObjectStateSet(plugin.PluginName, "ON", serviceObject);
             Log.Info("Plugin started: " + plugin.PluginName);
         }
     }
     catch (Exception ex)
     {
         Log.Error("Error starting plugin (" + plugin.PluginName + ")", ex);
         plugin.Running = false;
     }
 }
All Usage Examples Of OSAE.Plugin::ActivatePlugin