コード例 #1
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + Id.GetHashCode();
            hash = hash * 23 + Name.GetHashCode();
            hash = hash * 23 + Seats.GetHashCode();
            hash = hash * 23 + Region.GetHashCode();
            hash = hash * 23 + CoatOfArms.GetHashCode();
            hash = hash * 23 + Words.GetHashCode();
            hash = hash * 23 + Titles.GetHashCode();
            hash = hash * 23 + CurrentLord.GetHashCode();
            hash = hash * 23 + Founder.GetHashCode();
            hash = hash * 23 + Founded.GetHashCode();
            hash = hash * 23 + Heir.GetHashCode();
            hash = hash * 23 + Overlord.GetHashCode();
            hash = hash * 23 + DiedOut.GetHashCode();
            hash = hash * 23 + AncestralWeapons.GetHashCode();
            hash = hash * 23 + CadetBranches.GetHashCode();

            return(hash);
        }
コード例 #2
0
        public bool Equals(HouseDto 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) &&
                   Seats.SequenceEqual(other.Seats) &&
                   string.Equals(Region, other.Region) &&
                   string.Equals(CoatOfArms, other.CoatOfArms) &&
                   string.Equals(Words, other.Words) &&
                   Titles.SequenceEqual(other.Titles) &&
                   CurrentLord == other.CurrentLord &&
                   Founder == other.Founder &&
                   string.Equals(Founded, other.Founded) &&
                   Heir == other.Heir &&
                   Overlord == other.Overlord &&
                   string.Equals(DiedOut, other.DiedOut) &&
                   AncestralWeapons.SequenceEqual(other.AncestralWeapons) &&
                   CadetBranches.SequenceEqual(other.CadetBranches));
        }
コード例 #3
0
        /// <summary>
        ///     Defines what happens when the page is navigated on.
        /// </summary>
        /// <param name="parameter">parameter.</param>
        /// <param name="mode">navigation mode.</param>
        /// <param name="state">state.</param>
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            //Deciding if the house is searched by id or name.
            int intParam = 0;

            if (int.TryParse(parameter.ToString(), out intParam))
            {
                var houseId = (int)parameter;
                var service = new HouseService();
                House = await service.GetHouseAsync(houseId);
            }
            else
            {
                var houseName = (string)parameter;
                var service   = new HouseService();

                var houseList = await service.GetHouseAsync(houseName);

                foreach (var item in houseList)
                {
                    House = item;
                }
            }

            //If no such house is found, navigate the user to the not found page.
            if (House == null)
            {
                NavigateToNotFoundPage();
                return;
            }

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

            //Fill the lists on the UI, transforming uris if needed.
            foreach (string title in House.titles)
            {
                Titles.Add(new Models.Attribute(title));
            }

            foreach (string seats in House.seats)
            {
                Seats.Add(new Models.Attribute(seats));
            }

            foreach (string ancestralWeapons in House.ancestralWeapons)
            {
                AncestralWeapons.Add(new Models.Attribute(ancestralWeapons));
            }

            foreach (string houseUri in House.cadetBranches)
            {
                TransformUriToHouse(houseUri, CadetBranches);
            }

            foreach (string characterUri in House.swornMembers)
            {
                TransformUriToCharacter(characterUri, SwornMembers);
            }

            TransformUriToCharacter(House.currentLord, CurrentLord);
            TransformUriToCharacter(House.heir, Heir);
            TransformUriToCharacter(House.overlord, Overlord);
            TransformUriToCharacter(House.founder, Founder);

            await base.OnNavigatedToAsync(parameter, mode, state);
        }
コード例 #4
0
 public string[] ParseAncestralWeapons()
 {
     return(AncestralWeapons.Split(SplitDelimiter));
 }