示例#1
0
        private void LoadPlugInsActions()
        {
            ObservableList <Act>           PlugInsActions = new ObservableList <Act>();
            ObservableList <PlugInWrapper> PlugInsList    = App.LocalRepository.GetSolutionPlugIns();

            foreach (PlugInWrapper PW in PlugInsList)
            {
                try
                {
                    if (PW.Actions != null && PW.Actions.Count > 0)
                    {
                        foreach (PlugInAction PIA in PW.Actions)
                        {
                            ActPlugIn act = new ActPlugIn();
                            act.Description = PIA.Description;
                            act.Active      = true;
                            act.PlugInName  = PW.Name;
                            act.GetOrCreateInputParam(ActPlugIn.Fields.PluginID, PW.ID);
                            act.GetOrCreateInputParam(ActPlugIn.Fields.PlugInActionID, PIA.ID);
                            act.GetOrCreateInputParam(ActPlugIn.Fields.PluginDescription, PIA.Description);
                            act.GetOrCreateInputParam(ActPlugIn.Fields.PluginUserDescription, PIA.UserDescription);
                            act.GetOrCreateInputParam(ActPlugIn.Fields.PluginUserRecommendedUseCase, PIA.UserRecommendedUseCase);

                            PlugInsActions.Add(act);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Failed to get the Action of the Plugin '" + PW.Name + "'", ex);
                }
            }
            if (PlugInsActions.Count > 0)
            {
                IsPlugInAvailable = true;
            }
            PlugInsActionsGrid.DataSourceList = PlugInsActions;
        }
示例#2
0
        private void LoadPluginsActions()
        {
            ObservableList <PluginPackage> plugins        = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <PluginPackage>();
            ObservableList <Act>           PlugInsActions = new ObservableList <Act>();

            foreach (PluginPackage pluginPackage in plugins)
            {
                try
                {
                    List <StandAloneAction> actions = pluginPackage.LoadServicesInfoFromFile(); // GetStandAloneActions();

                    foreach (StandAloneAction standAloneAction in actions)
                    {
                        ActPlugIn act = new ActPlugIn();
                        act.Description = standAloneAction.Description;
                        act.GetOrCreateInputParam(nameof(ActPlugIn.PluginId), pluginPackage.PluginID);
                        act.GetOrCreateInputParam(nameof(ActPlugIn.ServiceId), standAloneAction.ServiceID);
                        act.GetOrCreateInputParam(nameof(ActPlugIn.GingerActionId), standAloneAction.ID);
                        foreach (var v in standAloneAction.InputValues)
                        {
                            act.InputValues.Add(new ActInputValue()
                            {
                                Param = v.Param
                            });
                        }
                        act.Active = true;
                        PlugInsActions.Add(act);
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Failed to get the Action of the Plugin '" + pluginPackage.PluginID + "'", ex);
                }
            }

            PlugInsActionsGrid.DataSourceList = PlugInsActions;
        }
        public void SendActionToRemoteGridOnProcess()
        {
            // TODO: start the service batch + plugin to connect, for now we use manual bat file for testing

            // Arrange
            ActPlugIn actPlugin = new ActPlugIn()
            {
                ServiceId = "DummyService", ActionId = "Sum"
            };

            actPlugin.GetOrCreateInputParam("a").Value     = "4";
            actPlugin.GetOrCreateInputParam("a").ParamType = typeof(int);
            actPlugin.GetOrCreateInputParam("b").Value     = "3";
            actPlugin.GetOrCreateInputParam("b").ParamType = typeof(int);

            //Act
            GingerNodeProxy.RemoteGridIP   = RemoteGridIP; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            GingerNodeProxy.RemoteGridPort = 15555;        // RemoteGridPort; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            GingerNodeInfo gingerNodeInfo = new GingerNodeInfo()
            {
            };
            GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true);

            NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin);

            for (int i = 0; i < 1000; i++)
            {
                NewPayLoad actionResult = gingerNodeProxy.RunAction(actionPayLoad);
                ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin);
            }

            //Assert
            Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2);
            // Assert.AreEqual("A1 Result", actPlugin.ExInfo);
        }
示例#4
0
        // We Bind the controls on the page to the action input params based on the Xaml object Name - x:Name=
        //this is recursive function which drill down when needed
        private void BindControlsToAction(Panel container)
        {
            foreach (UIElement e in container.Children)
            {
                // recursive bind for example for StackPanle or other controls Panel
                if (e is Panel)
                {
                    BindControlsToAction((Panel)e);
                }

                string name = (string)e.GetValue(NameProperty);
                // We bind control based on their name
                if (!string.IsNullOrEmpty(name))
                {
                    ActInputValue v = mAct.GetOrCreateInputParam(name);

                    //Bind a text box
                    App.ObjFieldBinding((Control)e, TextBox.TextProperty, v, "Value");

                    //TODO: check control type and bind per type
                }
            }
        }