public bool Equals(CharacterDto other)
        {
            if (other == null)
            {
                return(false);
            }

            ////Note that SequenceEqual will return false if the items are the same but in different orders.
            return(Id == other.Id &&
                   string.Equals(Name, other.Name) &&
                   string.Equals(Culture, other.Culture) &&
                   Titles.SequenceEqual(other.Titles) &&
                   OtherTitles.SequenceEqual(other.OtherTitles) &&
                   Aliases.SequenceEqual(other.Aliases) &&
                   string.Equals(Born, other.Born) &&
                   string.Equals(Died, other.Died) &&
                   Father == other.Father &&
                   Mother == other.Mother &&
                   Spouse == other.Spouse &&
                   Children.SequenceEqual(other.Children) &&
                   Allegiances.SequenceEqual(other.Allegiances) &&
                   Books.SequenceEqual(other.Books) &&
                   PovBooks.SequenceEqual(other.PovBooks) &&
                   PlayedBy.SequenceEqual(other.PlayedBy) &&
                   TvSeries.SequenceEqual(other.TvSeries));
        }
Example #2
0
        public Allegiance GetAllegianceFromCode(string code)
        {
            // TODO: Consider hashtable
            Allegiance alleg = Allegiances.Where(a => a.T5Code == code).FirstOrDefault();

            return(alleg ?? SecondSurvey.GetStockAllegianceFromCode(code));
        }
Example #3
0
        public void Merge(Sector metadataSource)
        {
            if (metadataSource == null)
            {
                throw new ArgumentNullException("metadataSource");
            }

            // TODO: This is very fragile; if a new type is added to Sector we need to add more code here.

            if (metadataSource.Names.Any())
            {
                Names.Clear(); Names.AddRange(metadataSource.Names);
            }

            if (metadataSource.DataFile != null && DataFile != null &&
                (metadataSource.DataFile.FileName != DataFile.FileName ||
                 metadataSource.DataFile.Type != DataFile.Type))
            {
                throw new Exception(string.Format("Mismatching DataFile entries for {0}", this.Names[0].Text));
            }

            if (metadataSource.DataFile != null)
            {
                DataFile = metadataSource.DataFile;
            }

            Subsectors.AddRange(metadataSource.Subsectors);
            Allegiances.AddRange(metadataSource.Allegiances);
            Borders.AddRange(metadataSource.Borders);
            Routes.AddRange(metadataSource.Routes);
            Labels.AddRange(metadataSource.Labels);
            Credits = metadataSource.Credits;
            Products.AddRange(metadataSource.Products);
            StylesheetText = metadataSource.StylesheetText;
        }
Example #4
0
        public Allegiance GetAllegiance(string code)
        {
            // TODO: Consider hashtable
            Allegiance alleg = Allegiances.Where(a => a.Code == code).FirstOrDefault();

            return(alleg != null ? alleg : Allegiance.GetStockAllegiance(code));
        }
Example #5
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);
        }
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + Id.GetHashCode();
            hash = hash * 23 + Name.GetHashCode();
            hash = hash * 23 + Culture.GetHashCode();
            hash = hash * 23 + Titles.GetHashCode();
            hash = hash * 23 + OtherTitles.GetHashCode();
            hash = hash * 23 + Aliases.GetHashCode();
            hash = hash * 23 + Born.GetHashCode();
            hash = hash * 23 + Died.GetHashCode();
            hash = hash * 23 + Father.GetHashCode();
            hash = hash * 23 + Mother.GetHashCode();
            hash = hash * 23 + Spouse.GetHashCode();
            hash = hash * 23 + Children.GetHashCode();
            hash = hash * 23 + Allegiances.GetHashCode();
            hash = hash * 23 + Books.GetHashCode();
            hash = hash * 23 + PovBooks.GetHashCode();
            hash = hash * 23 + PlayedBy.GetHashCode();
            hash = hash * 23 + TvSeries.GetHashCode();

            return(hash);
        }
        //Függvény, ami meghívódik, ha a CharacterDetailsPage lesz az aktív View
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            //Egy új service indítása, a paraméterben kapott karakter adatainak betöltése
            string     url     = (string)parameter;
            GoTService service = new GoTService();

            Character = await service.GetAsync <Character>(new Uri(url));

            if (!Character.Father.Equals(""))
            {
                var father = await service.GetAsync <Character>(new Uri(Character.Father));

                Father = father.Name;
            }

            if (!Character.Mother.Equals(""))
            {
                var mother = await service.GetAsync <Character>(new Uri(Character.Mother));

                Mother = mother.Name;
            }

            if (Character.Spouse.Length > 0)
            {
                var spouse = await service.GetAsync <Character>(new Uri(Character.Spouse));

                Spouse = spouse.Name;
            }

            if (!Character.Titles[0].Equals(""))
            {
                string titles = "";
                foreach (string title in Character.Titles)
                {
                    titles += title + ", ";
                }
                Titles = DeleteLastComa(titles);
            }

            if (!Character.Aliases[0].Equals(""))
            {
                string aliases = "";
                foreach (string alias in Character.Aliases)
                {
                    aliases += alias + ", ";
                }
                Aliases = DeleteLastComa(aliases);
            }

            if (Character.Books.Length > 0)
            {
                foreach (var bookURL in Character.Books)
                {
                    var book = await service.GetAsync <Book>(new Uri(bookURL));

                    this.BookArray.Add(book);
                }
            }
            else
            {
                BookArray.Add(new Book {
                    Name = "N/A"
                });
            }

            if (Character.PovBooks.Length > 0)
            {
                foreach (var povBookURL in Character.PovBooks)
                {
                    var povBook = await service.GetAsync <Book>(new Uri(povBookURL));

                    this.PovBookArray.Add(povBook);
                }
            }
            else
            {
                PovBookArray.Add(new Book {
                    Name = "N/A"
                });
            }

            if (Character.Allegiances.Length > 0)
            {
                foreach (var houseURL in Character.Allegiances)
                {
                    var house = await service.GetAsync <House>(new Uri(houseURL));

                    this.Allegiances.Add(house);
                }
            }
            else
            {
                Allegiances.Add(new House {
                    Name = "N/A"
                });
            }

            if (!Character.TvSeries[0].Equals(""))
            {
                string series = "";
                foreach (var season in Character.TvSeries)
                {
                    series += season + "\n";
                }
                TvSeries = series;
            }

            if (!Character.Playedby[0].Equals(""))
            {
                string playedBy = "";
                foreach (var actor in Character.Playedby)
                {
                    playedBy += actor + ", ";
                }
                PlayedBy = DeleteLastComa(playedBy);
            }

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