コード例 #1
0
        private void SetLocatorsGridView()
        {
            GridViewDef defView = new GridViewDef(GridViewDef.DefaultViewName);

            defView.GridColsView = new ObservableList <GridColView>();
            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.Active), WidthWeight = 8, MaxWidth = 50, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, StyleType = GridColView.eGridColStyleType.CheckBox
            });
            List <GingerCore.General.ComboEnumItem> locateByList = GingerCore.General.GetEnumValuesForCombo(typeof(eLocateBy));


            GingerCore.General.ComboEnumItem comboItem = locateByList.Where(x => ((eLocateBy)x.Value) == eLocateBy.POMElement).FirstOrDefault();
            if (comboItem != null)
            {
                locateByList.Remove(comboItem);
            }

            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.LocateBy), Header = "Locate By", WidthWeight = 25, StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = locateByList,
            });
            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.LocateValue), Header = "Locate Value", WidthWeight = 65
            });
            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.Help), WidthWeight = 25, ReadOnly = true
            });
            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.IsAutoLearned), Header = "Auto Learned", WidthWeight = 10, MaxWidth = 100, ReadOnly = true
            });
            defView.GridColsView.Add(new GridColView()
            {
                Field = "Test", WidthWeight = 10, MaxWidth = 100, AllowSorting = true, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.PageGrid.Resources["xTestElementButtonTemplate"]
            });
            defView.GridColsView.Add(new GridColView()
            {
                Field = nameof(ElementLocator.StatusIcon), Header = "Status", WidthWeight = 10, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.PageGrid.Resources["xTestStatusIconTemplate"]
            });
            xLocatorsGrid.SetAllColumnsDefaultView(defView);
            xLocatorsGrid.InitViewItems();

            xLocatorsGrid.SetTitleStyle((Style)TryFindResource("@ucTitleStyle_4"));
            xLocatorsGrid.AddToolbarTool(eImageType.Play, "Test All Elements Locators", new RoutedEventHandler(TestAllElementsLocators));
            xLocatorsGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddLocatorButtonClicked));
            xLocatorsGrid.SetbtnDeleteHandler(new RoutedEventHandler(DeleteLocatorClicked));

            xLocatorsGrid.grdMain.PreparingCellForEdit += LocatorsGrid_PreparingCellForEdit;
            xLocatorsGrid.PasteItemEvent += PasteLocatorEvent;
        }
コード例 #2
0
 private void ActionValueComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // We keep the GUID of the action or activity
     GingerCore.General.ComboEnumItem CEI = (GingerCore.General.ComboEnumItem)ActionValueComboBox.SelectedItem;
     if (CEI != null)
     {
         FC.Value = CEI.Value.ToString();
     }
     else
     {
         FC.Value = null;
     }
 }
コード例 #3
0
ファイル: General.cs プロジェクト: romal22/Ginger
        public static List <GingerCore.General.ComboEnumItem> GetEnumValuesForCombo(Type Etype)
        {
            List <GingerCore.General.ComboEnumItem> list = new List <GingerCore.General.ComboEnumItem>();

            foreach (object item in Enum.GetValues(Etype))
            {
                GingerCore.General.ComboEnumItem CEI = new GingerCore.General.ComboEnumItem();
                CEI.text  = GingerCore.General.GetEnumValueDescription(Etype, item);
                CEI.Value = item;

                list.Add(CEI);
            }
            return(list);
        }
コード例 #4
0
        private void SetActionValueComboData()
        {
            ActionValueComboBox.Items.Clear();
            ActionValueComboBox.Visibility = System.Windows.Visibility.Collapsed;
            ActionValueTextBox.Visibility  = System.Windows.Visibility.Collapsed;

            // For Business flow Control in Run Set
            if (mBfParentRunner != null)
            {
                switch (FC.BusinessFlowControlAction)
                {
                case eBusinessFlowControlAction.GoToBusinessFlow:
                {
                    foreach (BusinessFlow bf in mBfParentRunner.BusinessFlows)
                    {
                        if (App.MainWindow.SelectedSolutionTab == MainWindow.eSolutionTabType.Run && mActParentBusinessFlow == bf)        //TODO: do better condition
                        {
                            continue;
                        }

                        GingerCore.General.ComboEnumItem CEI = new GingerCore.General.ComboEnumItem();
                        CEI.Value = bf.InstanceGuid + FC.GUID_NAME_SEPERATOR + bf.Name;        //adding also name as second option search to be used when pulling the activity from Shared Repository
                        CEI.text  = bf.Name;
                        ActionValueComboBox.Items.Add(CEI);

                        if (ActionValueComboBox.SelectedItem == null || (ActionValueComboBox.SelectedItem != null && bf.Active))
                        {
                            if (FC.GetGuidFromValue(true) == bf.InstanceGuid)
                            {
                                ActionValueComboBox.SelectedItem = CEI;
                            }
                            else if (FC.GetGuidFromValue(true) == Guid.Empty && FC.GetNameFromValue(true) == bf.RunDescription)
                            {
                                ActionValueComboBox.SelectedItem = CEI;
                            }
                        }
                    }
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Visible;
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Hidden;

                    if (FC.Value != null && ActionValueComboBox.SelectedItem == null)
                    {
                        Reporter.ToUser(eUserMsgKey.ActivityIDNotFound, FC.Value);
                    }
                    break;
                }

                case eBusinessFlowControlAction.SetVariableValue:
                {
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Visible;
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }
                }
            }
            else
            {
                switch (FC.FlowControlAction)
                {
                case eFlowControlAction.GoToAction:
                {
                    if (mActParentActivity != null)
                    {
                        foreach (Act a in mActParentActivity.Acts)
                        {
                            //avoid current Action
                            if (App.MainWindow.SelectedSolutionTab == MainWindow.eSolutionTabType.BusinessFlows && mActParentBusinessFlow.CurrentActivity.Acts.CurrentItem == a)        //TODO: do better condition
                            {
                                continue;
                            }

                            GingerCore.General.ComboEnumItem CEI = new GingerCore.General.ComboEnumItem();
                            CEI.Value = a.Guid + FC.GUID_NAME_SEPERATOR + a.Description;        //adding also name as second option search to be used when pulling the actions from Shared Repository
                            CEI.text  = a.Description;
                            ActionValueComboBox.Items.Add(CEI);

                            if (ActionValueComboBox.SelectedItem == null ||
                                ((ActionValueComboBox.SelectedItem != null && a.Active)))
                            {
                                if (FC.GetGuidFromValue(true) == a.Guid)        //we letting it run each time because in Conversion mechanism we have 2 actions with same GUID
                                {
                                    ActionValueComboBox.SelectedItem = CEI;
                                }
                                else if (FC.GetGuidFromValue(true) == Guid.Empty && FC.GetNameFromValue(true) == a.Description)
                                {
                                    ActionValueComboBox.SelectedItem = CEI;
                                }
                            }
                        }
                        ActionValueComboBox.Visibility = System.Windows.Visibility.Visible;
                        ActionValueTextBox.Visibility  = System.Windows.Visibility.Hidden;

                        if (FC.Value != null && ActionValueComboBox.SelectedItem == null)
                        {
                            Reporter.ToUser(eUserMsgKey.ActionIDNotFound, FC.Value);
                        }
                    }
                }
                break;

                case eFlowControlAction.GoToActivity:
                {
                    foreach (Activity a in mActParentBusinessFlow.Activities)
                    {
                        if (App.MainWindow.SelectedSolutionTab == MainWindow.eSolutionTabType.BusinessFlows && mActParentBusinessFlow.CurrentActivity == a)        //TODO: do better condition
                        {
                            continue;
                        }

                        GingerCore.General.ComboEnumItem CEI = new GingerCore.General.ComboEnumItem();
                        CEI.Value = a.Guid + FC.GUID_NAME_SEPERATOR + a.ActivityName;        //adding also name as second option search to be used when pulling the activity from Shared Repository
                        CEI.text  = a.ActivityName;
                        ActionValueComboBox.Items.Add(CEI);

                        if (ActionValueComboBox.SelectedItem == null ||
                            (ActionValueComboBox.SelectedItem != null && a.Active))
                        {
                            if (FC.GetGuidFromValue(true) == a.Guid)
                            {
                                ActionValueComboBox.SelectedItem = CEI;
                            }
                            else if (FC.GetGuidFromValue(true) == Guid.Empty && FC.GetNameFromValue(true) == a.Description)
                            {
                                ActionValueComboBox.SelectedItem = CEI;
                            }
                        }
                    }
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Visible;
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Hidden;

                    if (FC.Value != null && ActionValueComboBox.SelectedItem == null)
                    {
                        Reporter.ToUser(eUserMsgKey.ActivityIDNotFound, FC.Value);
                    }
                    break;
                }

                case eFlowControlAction.MessageBox:
                {
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Visible;
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }

                case eFlowControlAction.SetVariableValue:
                {
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Visible;
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }

                case eFlowControlAction.RunSharedRepositoryActivity:
                case eFlowControlAction.GoToActivityByName:
                {
                    ActionValueTextBox.Visibility  = System.Windows.Visibility.Visible;
                    ActionValueComboBox.Visibility = System.Windows.Visibility.Hidden;
                    break;
                }
                }
            }
        }