示例#1
0
        /// <summary>
        /// Constructor which loads a known Bible version <c>XDocument</c> and sets metadata about it.
        /// </summary>
        /// <param name="fileName">The Bible version file name wanted to load.</param>
        public BibleVersion(string fileName)
        {
            FileName   = fileName;
            m_filePath = Path.Combine(Package.Current.InstalledLocation.Path, BibleLoader.BIBLE_PATH + "/" + fileName);

            // Set information from XML
            Language     = XDocument.Root.Element(Zefania.NDE_INFO).Element(Zefania.NDE_LANG).Value;
            Title        = XDocument.Root.Element(Zefania.NDE_INFO).Element(Zefania.NDE_TITLE).Value;
            Abbreviation = XDocument.Root.Element(Zefania.NDE_INFO).Element(Zefania.VERSION_ABBR).Value;

            // Find the book names in XML
            foreach (XElement element in XDocument.Descendants(Zefania.NDE_BIBLEBOOK))
            {
                BookNames.Add(element.Attribute(Zefania.ATTR_BOOKNAME).Value);
            }

            // Find the book short names in XML
            foreach (XElement element in XDocument.Descendants(Zefania.NDE_BIBLEBOOK))
            {
                BookAbbreviations.Add(element.Attribute(Zefania.ATTR_BOOKSHORTNAME).Value);
            }

            // Find the book numbers in XML
            foreach (XElement element in XDocument.Descendants(Zefania.NDE_BIBLEBOOK))
            {
                BookNumbers.Add(int.Parse(element.Attribute(Zefania.ATTR_BOOKNUM).Value));
            }
        }
示例#2
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            //gets the requested character
            string url    = (string)parameter;
            var    client = new GoTService();

            CurrentCharacter = await client.GetCharacterByUrlAsync(url);

            //First we need to check if the father data exists, if yes, the app makes a new call to the API to get the father's name
            if (CurrentCharacter.Father != "")
            {
                Character father = await client.GetCharacterByUrlAsync(CurrentCharacter.Father);

                FatherName = father.Name;
            }

            if (CurrentCharacter.Mother != "")
            {
                Character mother = await client.GetCharacterByUrlAsync(CurrentCharacter.Mother);

                MotherName = mother.Name;
            }

            if (CurrentCharacter.Spouse != "")
            {
                Character spouse = await client.GetCharacterByUrlAsync(CurrentCharacter.Spouse);

                SpouseName = spouse.Name;
            }

            foreach (var house in CurrentCharacter.Allegiances)
            {
                House h = await client.GetHouseByUrlAsync(house);

                //types are needed for navigation
                _allegiances.Add(h);
                //name is shown on the UI
                Allegiances.Add(h.Name);
            }

            foreach (var bookName in CurrentCharacter.Books)
            {
                Book b = await client.GetBookByUrlAsync(bookName);

                _books.Add(b);
                BookNames.Add(b.Name);
            }

            foreach (var povBookName in CurrentCharacter.PovBooks)
            {
                Book b = await client.GetBookByUrlAsync(povBookName);

                _povBooks.Add(b);
                PovBookNames.Add(b.Name);
            }

            await base.OnNavigatedToAsync(parameter, mode, state);
        }