Пример #1
0
        public void Setup(XML xml)
        {
            string[] arr;

            name = xml.GetAttribute("name");
            autoRadioGroupDepth = xml.GetAttributeBool("autoRadioGroupDepth");

            arr = xml.GetAttributeArray("pages");
            if (arr != null)
            {
                int cnt = arr.Length;
                for (int i = 0; i < cnt; i += 2)
                {
                    _pageIds.Add(arr[i]);
                    _pageNames.Add(arr[i + 1]);
                }
            }

            arr = xml.GetAttributeArray("transitions");
            if (arr != null)
            {
                _pageTransitions = new List <PageTransition>();

                int cnt = arr.Length;
                for (int i = 0; i < cnt; i++)
                {
                    string str = arr[i];

                    PageTransition pt = new PageTransition();
                    int            k  = str.IndexOf("=");
                    pt.transitionName = str.Substring(k + 1);
                    str        = str.Substring(0, k);
                    k          = str.IndexOf("-");
                    pt.toIndex = int.Parse(str.Substring(k + 1));
                    str        = str.Substring(0, k);
                    if (str == "*")
                    {
                        pt.fromIndex = -1;
                    }
                    else
                    {
                        pt.fromIndex = int.Parse(str);
                    }
                    _pageTransitions.Add(pt);
                }
            }

            if (parent != null && _pageIds.Count >= 0)
            {
                _selectedIndex = 0;
            }
            else
            {
                _selectedIndex = -1;
            }
        }
Пример #2
0
        public void Setup(XML xml)
        {
            string[] arr;

            name = xml.GetAttribute("name");
            autoRadioGroupDepth = xml.GetAttributeBool("autoRadioGroupDepth");

            arr = xml.GetAttributeArray("pages");
            if (arr != null)
            {
                int cnt = arr.Length;
                for (int i = 0; i < cnt; i += 2)
                {
                    _pageIds.Add(arr[i]);
                    _pageNames.Add(arr[i + 1]);
                }
            }

            arr = xml.GetAttributeArray("transitions");
            if (arr != null)
            {
                _pageTransitions = new List<PageTransition>();

                int cnt = arr.Length;
                for (int i = 0; i < cnt; i++)
                {
                    string str = arr[i];

                    PageTransition pt = new PageTransition();
                    int k = str.IndexOf("=");
                    pt.transitionName = str.Substring(k + 1);
                    str = str.Substring(0, k);
                    k = str.IndexOf("-");
                    pt.toIndex = int.Parse(str.Substring(k + 1));
                    str = str.Substring(0, k);
                    if (str == "*")
                        pt.fromIndex = -1;
                    else
                        pt.fromIndex = int.Parse(str);
                    _pageTransitions.Add(pt);
                }
            }

            if (parent != null && _pageIds.Count >= 0)
                _selectedIndex = 0;
            else
                _selectedIndex = -1;
        }