Esempio n. 1
0
        public static WebElementViewModel CreateModelFromInfo(WebElementInfo info)
        {
            WebElementViewModel model = null;

            if (info is WebContext webContext)
            {
                model = new WebContextViewModel();
                model.FillFromInfo(webContext);
            }
            else if (info is DropDownElementInfo dropDown)
            {
                model = new DropDownElementViewModel();
                model.FillFromInfo(dropDown);
            }
            else if (info is RadioGroupElementInfo radioGroup)
            {
                model = new RadioGroupViewModel();
                model.FillFromInfo(radioGroup);
            }
            else if (info is CombinedWebElementInfo combined)
            {
                model = new CombinedElementViewModel();
                model.FillFromInfo(combined);
            }
            else
            {
                model = new WebElementViewModel();
                model.FillFromInfo(info);
            }

            return(model);
        }
Esempio n. 2
0
        public static WebElementInfo CreateInfoFromModel(WebElementViewModel model)
        {
            WebElementInfo info = null;

            if (model is WebContextViewModel webContext)
            {
                info = new WebContext();
                webContext.FillInfo(info);
            }
            else if (model is DropDownElementViewModel dropDown)
            {
                info = new DropDownElementInfo();
                dropDown.FillInfo(info);
            }
            else if (model is RadioGroupViewModel radioGroup)
            {
                info = new RadioGroupElementInfo();
                radioGroup.FillInfo(info);
            }
            else if (model is CombinedElementViewModel combined)
            {
                info = new CombinedWebElementInfo();
                combined.FillInfo(info);
            }
            else
            {
                info = new WebElementInfo();
                model.FillInfo(info);
            }

            return(info);
        }
Esempio n. 3
0
        public WebElementDetailsWindow(WebElementViewModel model, List <string> existedNames, bool isUpdateMode)
        {
            if (isUpdateMode && existedNames != null)
            {
                existedNames.Remove(model.Name);
            }

            Model = new VersionedElementViewModel(model, existedNames);
            Model.IsUpdateMode = isUpdateMode;


            DataContext = Model;
            InitializeComponent();
        }
Esempio n. 4
0
        public static WebElementViewModel CreateWebElementModel(WebElementViewModel model = null)
        {
            if (model == null)
            {
                model = new WebElementViewModel {
                    ElementType = WebElementTypes.Element
                }
            }
            ;

            model.Name        = MockString;
            model.Description = MockString;
            model.WebLocator  =
                new WebLocatorViewModel
            {
                LocatorValue = MockString
            };

            return(model);
        }