示例#1
0
        private void ValueExpressionButton_Click(object sender, RoutedEventArgs e)
        {
            EnhancedActInputValue     AIV  = (EnhancedActInputValue)xAPIModelParamsValueUCGrid.CurrentItem;
            ValueExpressionEditorPage VEEW = new ValueExpressionEditorPage(AIV, nameof(ActInputValue.Value), mAddApiModelActionWizardPage.mContext);

            VEEW.ShowAsWindow();
        }
示例#2
0
        private void ValueExpressionButton_Click(object sender, RoutedEventArgs e)
        {
            EnhancedActInputValue     AIV  = (EnhancedActInputValue)APIModelParamsValueUCGrid.CurrentItem;
            ValueExpressionEditorPage VEEW = new ValueExpressionEditorPage(AIV, nameof(ActInputValue.Value), Context.GetAsContext(mAct.Context));

            VEEW.ShowAsWindow();
        }
示例#3
0
        private void ValueExpressionButton_Click(object sender, RoutedEventArgs e)
        {
            EnhancedActInputValue     AIV  = (EnhancedActInputValue)xAPIModelParamsValueUCGrid.CurrentItem;
            ValueExpressionEditorPage VEEW = new ValueExpressionEditorPage(AIV, ActInputValue.Fields.Value);

            VEEW.ShowAsWindow();
        }
        private ObservableList <EnhancedActInputValue> GetAPIActionParams(ObservableList <AppModelParameter> paramsList, Dictionary <System.Tuple <string, string>, List <string> > optionalValuesPulledFromConvertedAction)
        {
            ObservableList <EnhancedActInputValue> enhancedParamsList = new ObservableList <EnhancedActInputValue>();

            foreach (AppModelParameter apiModelParam in paramsList)
            {
                if (apiModelParam.RequiredAsInput == true)
                {
                    EnhancedActInputValue actAPIModelParam = new EnhancedActInputValue();
                    actAPIModelParam.ParamGuid   = apiModelParam.Guid;
                    actAPIModelParam.Param       = apiModelParam.PlaceHolder;
                    actAPIModelParam.Description = apiModelParam.Description;
                    foreach (OptionalValue optionalValue in apiModelParam.OptionalValuesList)
                    {
                        actAPIModelParam.OptionalValues.Add(optionalValue.Value);
                    }

                    //set value came from Action
                    foreach (System.Tuple <string, string> key in optionalValuesPulledFromConvertedAction.Keys)
                    {
                        if (key.Item2 == apiModelParam.Path)
                        {
                            if (optionalValuesPulledFromConvertedAction[key] != null && optionalValuesPulledFromConvertedAction[key].Count > 0)
                            {
                                actAPIModelParam.Value = optionalValuesPulledFromConvertedAction[key][0];
                                break;
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(actAPIModelParam.Value))
                    {
                        //set defualt value
                        OptionalValue ov = apiModelParam.OptionalValuesList.Where(x => x.IsDefault == true).FirstOrDefault();
                        if (ov != null)
                        {
                            actAPIModelParam.Value = ov.Value;
                        }
                    }

                    enhancedParamsList.Add(actAPIModelParam);
                }
            }
            return(enhancedParamsList);
        }
示例#5
0
        private void SetExecutionValue <T>(T param, ActWebAPIModel actWebAPIModel)
        {
            AppModelParameter     p            = param as AppModelParameter;
            EnhancedActInputValue enhanceInput = actWebAPIModel.APIModelParamsValue.Where(x => x.ParamGuid == p.Guid).FirstOrDefault();

            if (enhanceInput != null)
            {
                p.ExecutionValue = enhanceInput.ValueForDriver;
            }
            else
            {
                p.ExecutionValue = p.GetDefaultValue();
            }

            if (p is GlobalAppModelParameter && p.ExecutionValue.Equals(GlobalAppModelParameter.CURRENT_VALUE))
            {
                p.ExecutionValue = ((GlobalAppModelParameter)p).CurrentValue;
            }
        }
示例#6
0
        private ObservableList <EnhancedActInputValue> GetEnhancedUpdatedParams(ObservableList <AppModelParameter> paramsList)
        {
            ObservableList <EnhancedActInputValue> enhancedParamsList = new ObservableList <EnhancedActInputValue>();

            foreach (AppModelParameter ADP in paramsList)
            {
                if (ADP.RequiredAsInput == true)
                {
                    EnhancedActInputValue AIV = new EnhancedActInputValue();
                    AIV.ParamGuid   = ADP.Guid;
                    AIV.Param       = ADP.PlaceHolder;
                    AIV.Description = ADP.Description;
                    foreach (OptionalValue optionalValue in ADP.OptionalValuesList)
                    {
                        AIV.OptionalValues.Add(optionalValue.Value);
                    }

                    EnhancedActInputValue EAIV = null;
                    EAIV = EnhancedInputValueList.Where(x => x.Param == ADP.PlaceHolder).FirstOrDefault();
                    if (EAIV != null)
                    {
                        AIV.Value = EAIV.Value;
                    }
                    else
                    {
                        OptionalValue ov = null;
                        ov = ADP.OptionalValuesList.Where(x => x.IsDefault == true).FirstOrDefault();
                        if (ov != null)
                        {
                            AIV.Value = ov.Value;
                        }
                        //No Default, and no value selected - what to put
                    }

                    enhancedParamsList.Add(AIV);
                }
            }
            return(enhancedParamsList);
        }
示例#7
0
        public void WizardEvent(WizardEventArgs WizardEventArgs)
        {
            switch (WizardEventArgs.EventType)
            {
            case EventType.Init:
                mAddApiModelActionWizardPage = ((AddApiModelActionWizardPage)WizardEventArgs.Wizard);
                SetParamsGrid();
                break;

            case EventType.Active:
                ObservableList <EnhancedActInputValue> OldList = new ObservableList <EnhancedActInputValue>();
                foreach (EnhancedActInputValue value in mAddApiModelActionWizardPage.EnhancedInputValueList)
                {
                    EnhancedActInputValue oldVal = new EnhancedActInputValue();
                    oldVal.Guid         = value.Guid;
                    oldVal.ParamGuid    = value.ParamGuid;
                    oldVal.Param        = value.Param;
                    oldVal.ParamType    = value.ParamType;
                    oldVal.Value        = value.Value;
                    oldVal.Description  = value.Description;
                    oldVal.ExtraDetails = value.ExtraDetails;
                    OldList.Add(oldVal);
                }

                mAddApiModelActionWizardPage.EnhancedInputValueList.Clear();
                foreach (ApplicationAPIModel aamb in mAddApiModelActionWizardPage.AAMList)
                {
                    WorkSpace.Instance.RefreshGlobalAppModelParams(aamb);
                    MergeAndConvertToEnhancedList(aamb.MergedParamsList, OldList);
                }
                PopulateRelatedAPIsToParamsList();
                SortDropDownValues();
                break;
                //case EventType.Finish:

                //    break;
            }
        }
示例#8
0
        private bool UpdateParamsEnhancedLists(ObservableList <AppModelParameter> paramsList)
        {
            bool ShowNotification = false;

            if (paramsList != null)
            {
                int currNumOfActParams = mAct.APIModelParamsValue.Count;
                int numOfAPIParams     = 0;

                List <EnhancedActInputValue> OldAPIModelParamsValue = new List <EnhancedActInputValue>();
                foreach (EnhancedActInputValue value in mAct.APIModelParamsValue)
                {
                    OldAPIModelParamsValue.Add(value);
                }

                mAct.APIModelParamsValue.Clear();

                foreach (AppModelParameter AMDP in paramsList)
                {
                    if (AMDP.RequiredAsInput == true)
                    {
                        numOfAPIParams++;
                        EnhancedActInputValue paramToUpdate = OldAPIModelParamsValue.Where(x => x.ParamGuid == AMDP.Guid).FirstOrDefault();
                        if (paramToUpdate != null) //Param already been in the action list, just update his values
                        {
                            string OVDefaultValue = string.Empty;
                            foreach (OptionalValue OP in AMDP.OptionalValuesList)
                            {
                                //check if need to clear current optional values
                                paramToUpdate.OptionalValues.Add(OP.Value);
                                if (OP.IsDefault)
                                {
                                    OVDefaultValue = OP.Value;
                                }
                            }
                            if (string.IsNullOrEmpty(paramToUpdate.Value))
                            {
                                paramToUpdate.Value = OVDefaultValue;
                            }
                        }
                        else //Param is new add it to the list
                        {
                            ShowNotification        = true;
                            paramToUpdate           = new EnhancedActInputValue();
                            paramToUpdate.ParamGuid = AMDP.Guid;
                            foreach (OptionalValue OP in AMDP.OptionalValuesList)
                            {
                                paramToUpdate.OptionalValues.Add(OP.Value);
                                if (OP.IsDefault)
                                {
                                    paramToUpdate.Value = OP.Value;
                                }
                            }
                        }

                        paramToUpdate.Param       = AMDP.PlaceHolder;
                        paramToUpdate.Description = AMDP.Description;
                        //re-use selected value
                        if (OldAPIModelParamsValue.Where(x => x.Param == paramToUpdate.Param).FirstOrDefault() != null)
                        {
                            paramToUpdate.Value = OldAPIModelParamsValue.Where(x => x.Param == paramToUpdate.Param).FirstOrDefault().Value;
                        }
                        mAct.APIModelParamsValue.Add(paramToUpdate);
                    }
                }
                if (currNumOfActParams != numOfAPIParams)
                {
                    ShowNotification = true;
                }
            }
            return(ShowNotification);
        }
示例#9
0
        private void MergeAndConvertToEnhancedList(ObservableList <AppModelParameter> AppModelParameters, ObservableList <EnhancedActInputValue> OldList)
        {
            if (AppModelParameters != null)
            {
                foreach (AppModelParameter AMDP in AppModelParameters)
                {
                    if (AMDP.RequiredAsInput == true)
                    {
                        //Check if already exists in the list, if yes - add only its optional values and description
                        EnhancedActInputValue EAIV = null;
                        EAIV = mAddApiModelActionWizardPage.EnhancedInputValueList.Where(x => x.Param == AMDP.PlaceHolder).FirstOrDefault();
                        if (EAIV != null)
                        {
                            foreach (OptionalValue optionalValue in AMDP.OptionalValuesList)
                            {
                                if (!EAIV.OptionalValues.Contains(optionalValue.Value))
                                {
                                    if (optionalValue.IsDefault)
                                    {
                                        EAIV.Value = optionalValue.Value;
                                    }
                                    EAIV.OptionalValues.Add(optionalValue.Value);
                                }
                            }

                            if (!string.IsNullOrEmpty(EAIV.Description) && !EAIV.Description.Contains(AMDP.Description))
                            {
                                EAIV.Description += " | " + AMDP.Description;
                            }
                        }
                        else
                        {
                            //Not exists in the list, add it, his optional values and description
                            EnhancedActInputValue AIV = new EnhancedActInputValue();
                            AIV.ParamGuid   = AMDP.Guid;
                            AIV.Param       = AMDP.PlaceHolder;
                            AIV.Description = AMDP.Description;
                            string OldValue = string.Empty;
                            if (OldList != null && OldList.Count() > 0)
                            {
                                EnhancedActInputValue oldAIV = OldList.Where(x => x.ParamGuid == AMDP.Guid).FirstOrDefault();
                                if (oldAIV != null)
                                {
                                    OldValue = oldAIV.Value;
                                }
                                else
                                {
                                    OldValue = null;
                                }
                            }
                            foreach (OptionalValue optionalValue in AMDP.OptionalValuesList)
                            {
                                AIV.OptionalValues.Add(optionalValue.Value);

                                if (optionalValue.IsDefault)
                                {
                                    AIV.Value = optionalValue.Value;
                                }
                                else if (string.IsNullOrEmpty(AIV.Value))
                                {
                                    AIV.Value = optionalValue.Value;
                                }
                            }
                            if (!string.IsNullOrEmpty(OldValue))
                            {
                                AIV.Value = OldValue;
                            }

                            mAddApiModelActionWizardPage.EnhancedInputValueList.Add(AIV);
                        }
                    }
                }
            }
        }