Beispiel #1
0
 public static IDetectorPlugin UpdateDetector(IOpenRPAClient client, entity.Detector entity)
 {
     foreach (var d in detectorPluginTypes)
     {
         if (d.Key == entity.Plugin)
         {
             IDetectorPlugin plugin = Plugins.detectorPlugins.Where(x => x.Entity._id == entity._id).FirstOrDefault();
             if (plugin == null)
             {
                 return(AddDetector(client, entity));
             }
             try
             {
                 plugin.Stop();
                 plugin.Entity = entity;
                 if (string.IsNullOrEmpty(entity.name))
                 {
                     entity.name = plugin.Name;
                 }
                 plugin.Start();
                 return(plugin);
             }
             catch (Exception ex)
             {
                 Log.Error("OpenRPA.Interfaces.Plugins.AddDetector: " + ex.ToString());
             }
         }
     }
     return(null);
 }
Beispiel #2
0
        public void Start(bool doRegisterExchange)
        {
            IDetectorPlugin dp = Plugins.detectorPlugins.Where(x => x.Entity._id == _id).FirstOrDefault();

            if (dp == null)
            {
                dp = Plugins.AddDetector(RobotInstance.instance, this);
                if (dp == null)
                {
                    Log.Error("Failed loading detector " + name + " " + _id);
                    return;
                }
            }
            if (doRegisterExchange)
            {
                _ = RegisterExchange();
            }
            if (RobotInstance.instance != null && RobotInstance.instance.Window != null)
            {
                dp.OnDetector -= RobotInstance.instance.Window.OnDetector;
                dp.OnDetector += RobotInstance.instance.Window.OnDetector;
            }
            else
            {
                Log.Error("Failed registering detector event sink for " + name + " main window not loaded yet !!!!!");
            }
            dp.Start();
        }