Пример #1
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();
        }
Пример #2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            Log.FunctionIndent("DetectorsView", "Button_Click");
            try
            {
                var             btn = sender as System.Windows.Controls.Button;
                var             kv  = (System.Collections.Generic.KeyValuePair <string, System.Type>)btn.DataContext;
                var             d   = new Interfaces.entity.Detector(); d.Plugin = kv.Value.FullName;
                IDetectorPlugin dp  = null;
                d.Path = Interfaces.Extensions.ProjectsDirectory;
                NotifyPropertyChanged("detectorPlugins");
                d.name = kv.Value.Name;
                var result = await global.webSocketClient.InsertOne("openrpa", 0, false, d);

                d._id  = result._id;
                d._acl = result._acl;
                IDetectorPlugin exists = Plugins.detectorPlugins.Where(x => x.Entity._id == d._id).FirstOrDefault();
                if (exists == null)
                {
                    dp             = Plugins.AddDetector(RobotInstance.instance, d);
                    dp.OnDetector += main.OnDetector;
                    dp.Entity._id  = result._id;
                    dp.Entity._acl = result._acl;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            Log.FunctionOutdent("DetectorsView", "Button_Click");
        }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var             btn = sender as System.Windows.Controls.Button;
            var             kv  = (System.Collections.Generic.KeyValuePair <string, System.Type>)btn.DataContext;
            var             d   = new Interfaces.entity.Detector(); d.Plugin = kv.Value.FullName;
            IDetectorPlugin dp  = null;

            d.Path         = Interfaces.Extensions.ProjectsDirectory;
            dp             = Plugins.AddDetector(RobotInstance.instance, d);
            dp.OnDetector += main.OnDetector;
            NotifyPropertyChanged("detectorPlugins");
        }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AutomationHelper.syncContext = System.Threading.SynchronizationContext.Current;
            Task.Run(() =>
            {
                LabelStatusBar.Text = "Loading plugins";
                Plugins.loadPlugins(Extensions.projectsDirectory);
                if (string.IsNullOrEmpty(Config.local.wsurl))
                {
                    var Detectors = Interfaces.entity.Detector.loadDetectors(Extensions.projectsDirectory);
                    foreach (var d in Detectors)
                    {
                        IDetectorPlugin dp = null;
                        d.Path             = Extensions.projectsDirectory;
                        dp = Plugins.AddDetector(d);
                        if (dp != null)
                        {
                            dp.OnDetector += OnDetector;
                        }
                    }
                }

                ExpressionEditor.EditorUtil.init();
                AutomationHelper.init();
                new System.Activities.Core.Presentation.DesignerMetadata().Register();
                if (!string.IsNullOrEmpty(Config.local.wsurl))
                {
                    global.webSocketClient         = new Net.WebSocketClient(Config.local.wsurl);
                    global.webSocketClient.OnOpen += WebSocketClient_OnOpen;
                    _ = global.webSocketClient.Connect();
                }
                else
                {
                    CloseSplash();
                }
            });
        }