Ejemplo n.º 1
0
 public bool SetSelectedPage(int index)
 {
     try{
         Page = FormController.Model.Pages[index];
         return true;
     }catch(Exception ex)
     {
         Console.WriteLine(ex.Message);
         Page = FormController.Model.Pages[0];
         return false;
     }
 }
Ejemplo n.º 2
0
        protected Pages.Page ConstructPage(String pageStr)
        {
            Pages.Page page = new Pages.Page();

            MatchCollection fieldMatches = Regex.Matches(pageStr, "<field[\\s.*?]*?type=\"input\"(.+?)/?>(.*?</field>)?");
            int fieldCounter = 0;

            foreach(Match match in fieldMatches)
            {
                String value = match.Groups[0].Value;

                XmlDocument doc = new XmlDocument();
                try{
                    doc.LoadXml(value);
                }
                catch(Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                XmlNode node = doc.SelectSingleNode(@"/field");

                if(node != null && node.Attributes.Count > 2)
                    page.Fields.Add(ConstructDisplaySchemeField(node, fieldCounter++));
            }

            return page;
        }