Ejemplo n.º 1
0
        /// <summary>
        /// Parse the current screen of the dataProvider, using the element locator finder.
        /// </summary>
        /// <param name="simplified">If true, the simplified xml of the dataProvider will be used. Else - the full xml.</param>
        /// <returns></returns>
        public virtual Screen ParseScreen(bool simplified = true)
        {
            Screen screen = null;
            Logger.Log(string.Format("Parsing a {0} screen provided by {1}.",
                simplified ? "simplified" : "non-simplified",
                dataProvider.GetType().Name),
                () =>
                {
                    Logger.Log("-> LocatorFinder={0}", locatorFinder);
                    Logger.Log("-> NameFinder={0}", nameFinder);

                    var xml = simplified ? dataProvider.SimplifiedXml : dataProvider.Xml;
                    var screenshot = dataProvider.Screenshot;
                    screen = new Screen() { Name = "New Screen", Xml = xml, Screenshot = screenshot };

                    XElement root = XDocument.Parse(xml).Root;
                    countOfElementsToParse = root.DescendantsAndSelf().Count();
                    countOfParsedElements = 0;
                    root = root.RemoveAllNamespaces();
                    screen.Elements.AddRange(root.Elements().Select(e => ParseElement(e)));

                    foreach (var tool in tools)
                    {
                        var title = "Attempting to run tool '" + tool.GetType().FullName + "'";
                        Logger.Log(title, () =>
                        {
                            Utils.ExceptionHandling.Try(title, () => tool.UseTool(screen));
                        });
                    }
                });
            return screen;
        }
Ejemplo n.º 2
0
        private void GenerateScreenClass(Screen screen, string directory)
        {
            //TODO: Generate screen

            foreach (var element in screen.Elements)
                GenerateElementClass(element, directory);
        }