Ejemplo n.º 1
0
        private void Frame_BindingContextChanged(object sender, System.EventArgs e)
        {
            PersonNameModel tt = this.BindingContext as PersonNameModel;

            if (!(tt is null))
            {
                // TODO Show All Surnames

                PersonNameCards.Add(new CardListLine("Type:", tt.GType));
                PersonNameCards.Add(new CardListLine("Full Name:", tt.FullName));
                PersonNameCards.Add(new CardListLine("Title:", tt.GTitle));
                PersonNameCards.Add(new CardListLine("FirstName:", tt.GFirstName));
                PersonNameCards.Add(new CardListLine("SurName:", tt.GSurName.GetPrimarySurname));

                PersonNameCards.Add(new CardListLine("Alt:", tt.GAlt.GetDefaultText));
                PersonNameCards.Add(new CardListLine("Call:", tt.GCall));
                PersonNameCards.Add(new CardListLine("Date:", tt.GDate.GetShortDateAsString));
                PersonNameCards.Add(new CardListLine("Display:", tt.GDisplay));
                PersonNameCards.Add(new CardListLine("Family Nick:", tt.GFamilyNick));

                PersonNameCards.Add(new CardListLine("Group:", tt.GGroup));
                PersonNameCards.Add(new CardListLine("Nick:", tt.GNick));
                PersonNameCards.Add(new CardListLine("Priv:", tt.GPriv));
                PersonNameCards.Add(new CardListLine("Sort:", tt.GSort));

                this.BindingContext = PersonNameCards;
            }
        }
Ejemplo n.º 2
0
 public static PersonName ToPersonName(this PersonNameModel personNameModel)
 {
     return(new PersonName
     {
         GivenName = personNameModel.GivenName,
         FullMiddleName = personNameModel.FullMiddleName,
         FamilyName = personNameModel.FamilyName,
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Populates the view ViewModel.
        ///
        /// XML 1.71 all done
        /// </summary>
        /// <returns>
        /// </returns>
        public override void HandleViewDataLoadEvent()
        {
            BaseCL.RoutineEntry("NameDetailViewModel");

            HLinkPersonNameModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkPersonNameModel>((BaseParamsHLink));

            PersonNameObject = HLinkObject.DeRef;

            if (PersonNameObject.Valid)
            {
                BaseModelBase = PersonNameObject;

                // Get Header Details
                CardListLineCollection headerCardGroup = new CardListLineCollection {
                    Title = "Person Name Details"
                };
                headerCardGroup.Add(new CardListLine("Full Name:", PersonNameObject.FullName));
                BaseDetail.Add(headerCardGroup);

                // TODO Show All Surnames
                CardListLineCollection PersonNameCards = new CardListLineCollection("Name")
                {
                    new CardListLine("Type:", PersonNameObject.GType),
                    new CardListLine("Full Name:", PersonNameObject.FullName),
                    new CardListLine("Title:", PersonNameObject.GTitle),
                    new CardListLine("FirstName:", PersonNameObject.GFirstName),
                    new CardListLine("Primary SurName:", PersonNameObject.GSurName.GetPrimarySurname),
                    new CardListLine("Suffix:", PersonNameObject.GSuffix),

                    new CardListLine("Alternative:", PersonNameObject.GAlt.ToString()),
                    new CardListLine("Call:", PersonNameObject.GCall),
                    new CardListLine("Display:", PersonNameObject.GDisplay),
                    new CardListLine("Family Nick:", PersonNameObject.GFamilyNick),

                    new CardListLine("Group:", PersonNameObject.GGroup),
                    new CardListLine("Nick:", PersonNameObject.GNick),
                    new CardListLine("Priv:", PersonNameObject.Priv, true),
                    new CardListLine("Sort:", PersonNameObject.GSort)
                };

                BaseDetail.Add(PersonNameCards);

                // Get date card
                BaseDetail.Add(PersonNameObject.GDate.AsHLink("Name Date"));

                foreach (HLinkSurnameModel item in PersonNameObject.GSurName)
                {
                    CardListLineCollection SurnameCard = new CardListLineCollection("Surnames")
                    {
                        new CardListLine("Surname:", item.ToString()),
                        new CardListLine("Prefix:", item.DeRef.GPrefix),
                        new CardListLine("Primary:", item.DeRef.GPrim),
                        new CardListLine("Derivation:", item.DeRef.GDerivation),
                        new CardListLine("Connector:", item.DeRef.GConnector),
                    };

                    BaseDetail.Add(SurnameCard);
                }
            }

            return;
        }
        /// <summary>
        /// Populates the view ViewModel.
        ///
        /// XML 1.71 all done
        /// </summary>
        /// <returns>
        /// </returns>
        public override void PopulateViewModel()
        {
            BaseCL.LogRoutineEntry("NameDetailViewModel");

            PersonNameObject = DV.PersonNameDV.GetModelFromHLink(BaseNavParamsHLink);

            if (PersonNameObject.Valid)
            {
                BaseTitle = PersonNameObject.GetDefaultText;

                // Get media image
                HLinkHomeImageModel AddressImage = PersonNameObject.HomeImageHLink;
                AddressImage.CardType = DisplayFormat.MediaCardLarge;
                BaseDetail.Add(AddressImage);

                // Get Header Details
                CardGroup headerCardGroup = new CardGroup {
                    Title = "Person Name Details"
                };
                BaseDetail.Add(headerCardGroup);

                // TODO Show All Surnames
                CardListLineCollection PersonNameCards = new CardListLineCollection
                {
                    new CardListLine("Type:", PersonNameObject.GType),
                    new CardListLine("Full Name:", PersonNameObject.FullName),
                    new CardListLine("Title:", PersonNameObject.GTitle),
                    new CardListLine("FirstName:", PersonNameObject.GFirstName),
                    new CardListLine("SurName:", PersonNameObject.GSurName.GetPrimarySurname),
                    new CardListLine("Suffix:", PersonNameObject.GSuffix),

                    new CardListLine("Alt:", PersonNameObject.GAlt.GetDefaultText),
                    new CardListLine("Call:", PersonNameObject.GCall),
                    new CardListLine("Date:", PersonNameObject.GDate.ShortDate),
                    new CardListLine("Display:", PersonNameObject.GDisplay),
                    new CardListLine("Family Nick:", PersonNameObject.GFamilyNick),

                    new CardListLine("Group:", PersonNameObject.GGroup),
                    new CardListLine("Nick:", PersonNameObject.GNick),
                    new CardListLine("Priv:", PersonNameObject.GPriv),
                    new CardListLine("Sort:", PersonNameObject.GSort)
                };

                BaseDetail.Add(PersonNameCards);

                foreach (SurnameModel item in PersonNameObject.GSurName)
                {
                    CardListLineCollection SurnameCard = new CardListLineCollection
                    {
                        new CardListLine("Prefix:", item.GPrefix),
                        new CardListLine("Primary:", item.GPrim),
                        new CardListLine("Derivation:", item.GDerivation),
                        new CardListLine("Connector:", item.GConnector),
                    };

                    BaseDetail.Add(SurnameCard);
                }

                BaseDetail.Add(PersonNameObject.GCitationRefCollection.GetCardGroup());
                BaseDetail.Add(PersonNameObject.GNoteReferenceCollection.GetCardGroup());

                BaseDetail.Add(PersonNameObject.BackHLinkReferenceCollection.GetCardGroup());
            }

            return;
        }
        private HLinkPersonNameModelCollection GetPersonNameCollection(XElement xmlData)
        {
            HLinkPersonNameModelCollection t = new HLinkPersonNameModelCollection();

            var theERElement =
                from orElementEl
                in xmlData.Elements(ns + "name")
                select orElementEl;

            if (theERElement.Any())
            {
                // Load attribute object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    // TODO is date handling correct
                    PersonNameModel newPersonNameModel = new PersonNameModel
                    {
                        Handle = "PersonNameCollection",

                        GCitationRefCollection = GetCitationCollection(theLoadORElement),

                        GDate = SetDate(theLoadORElement),

                        GDisplay = GetElement(theLoadORElement, "display"),

                        GFamilyNick = GetElement(theLoadORElement, "familynick"),

                        GFirstName = GetElement(theLoadORElement, "first"),

                        GGroup = GetElement(theLoadORElement, "group"),

                        GNick = GetElement(theLoadORElement, "nick"),

                        GPriv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))),

                        GSort = GetElement(theLoadORElement, "sort"),

                        GSuffix = GetElement(theLoadORElement, "suffix"),

                        GSurName = GetSurnameCollection(theLoadORElement),

                        GTitle = GetElement(theLoadORElement, "title"),

                        GType = GetAttribute(theLoadORElement.Attribute("type")),

                        GNoteReferenceCollection = GetNoteCollection(theLoadORElement),
                    };

                    newPersonNameModel.GAlt.SetAlt(GetAttribute(theLoadORElement, "alt"));

                    // Set model hlinkkey
                    newPersonNameModel.HLinkKey = Guid.NewGuid().ToString();
                    DataStore.DS.PersonNameData.Add(newPersonNameModel);

                    // Create a HLink to the model
                    HLinkPersonNameModel newHlink = new HLinkPersonNameModel
                    {
                        HLinkKey = newPersonNameModel.HLinkKey
                    };

                    t.Add(newHlink);
                }
            }

            // Do not sort as the source file order is the one the creator wanted

            return(t);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Populates the view ViewModel.
        ///
        /// XML 1.71 all done
        /// </summary>
        /// <returns>
        /// </returns>
        public override void PopulateViewModel()
        {
            BaseCL.LogRoutineEntry("NameDetailViewModel");

            PersonNameObject = DV.PersonNameDV.GetModelFromHLink(BaseNavParamsHLink);

            if (PersonNameObject.Valid)
            {
                BaseTitle = PersonNameObject.GetDefaultText;

                // Trigger refresh of View fields via INotifyPropertyChanged
                RaisePropertyChanged(string.Empty);

                // Get media image
                MediaCard = PersonNameObject.HomeImageHLink.ConvertToHLinkMediaModel;

                // Get Header Details
                CardGroup headerCardGroup = new CardGroup {
                    Title = "Person Name Details"
                };
                BaseDetail.Add(headerCardGroup);

                // TODO Show All Surnames
                CardListLineCollection PersonNameCards = new CardListLineCollection
                {
                    new CardListLine("Type:", PersonNameObject.GType),
                    new CardListLine("Full Name:", PersonNameObject.FullName),
                    new CardListLine("Title:", PersonNameObject.GTitle),
                    new CardListLine("FirstName:", PersonNameObject.GFirstName),
                    new CardListLine("SurName:", PersonNameObject.GSurName.GetPrimarySurname),
                    new CardListLine("Suffix:", PersonNameObject.GSuffix),

                    new CardListLine("Alt:", PersonNameObject.GAlt.GetDefaultText),
                    new CardListLine("Call:", PersonNameObject.GCall),
                    new CardListLine("Display:", PersonNameObject.GDisplay),
                    new CardListLine("Family Nick:", PersonNameObject.GFamilyNick),

                    new CardListLine("Group:", PersonNameObject.GGroup),
                    new CardListLine("Nick:", PersonNameObject.GNick),
                    new CardListLine("Priv:", PersonNameObject.GPriv),
                    new CardListLine("Sort:", PersonNameObject.GSort)
                };

                BaseDetail.Add(PersonNameCards);

                // Get date card
                BaseDetail.Add(PersonNameObject.GDate.AsCardListLine());

                foreach (SurnameModel item in PersonNameObject.GSurName)
                {
                    CardListLineCollection SurnameCard = new CardListLineCollection
                    {
                        new CardListLine("Prefix:", item.GPrefix),
                        new CardListLine("Primary:", item.GPrim),
                        new CardListLine("Derivation:", item.GDerivation),
                        new CardListLine("Connector:", item.GConnector),
                    };

                    BaseDetail.Add(SurnameCard);
                }

                BaseDetail.Add(PersonNameObject.GCitationRefCollection.GetCardGroup());
                BaseDetail.Add(PersonNameObject.GNoteReferenceCollection.GetCardGroup());

                BaseDetail.Add(PersonNameObject.BackHLinkReferenceCollection.GetCardGroup());
            }

            return;
        }
        private HLinkPersonNameModelCollection GetPersonNameCollection(XElement xmlData)
        {
            HLinkPersonNameModelCollection t = new HLinkPersonNameModelCollection
            {
                Title = "Person Name Collection"
            };

            var theERElement =
                from orElementEl
                in xmlData.Elements(ns + "name")
                select orElementEl;

            if (theERElement.Any())
            {
                // Load attribute object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    // TODO is date handling correct
                    PersonNameModel newPersonNameModel = new PersonNameModel
                    {
                        GCitationRefCollection = GetCitationCollection(theLoadORElement),

                        GDate = SetDate(theLoadORElement),

                        GDisplay = GetElement(theLoadORElement, "display"),

                        GFamilyNick = GetElement(theLoadORElement, "familynick"),

                        GFirstName = GetElement(theLoadORElement, "first"),

                        GGroup = GetElement(theLoadORElement, "group"),

                        GNick = GetElement(theLoadORElement, "nick"),

                        Priv = GetPrivateObject(theLoadORElement),

                        GSort = GetElement(theLoadORElement, "sort"),

                        GSuffix = GetElement(theLoadORElement, "suffix"),

                        GSurName = GetSurnameCollection(theLoadORElement),

                        GTitle = GetElement(theLoadORElement, "title"),

                        GType = GetAttribute(theLoadORElement.Attribute("type")),

                        GNoteReferenceCollection = GetNoteCollection(theLoadORElement),
                    };

                    newPersonNameModel.GAlt = new AltModel(GetAttribute(theLoadORElement, "alt"));

                    newPersonNameModel.HLinkKey = HLinkKey.NewAsGUID();

                    DataStore.Instance.DS.PersonNameData.Add(newPersonNameModel);

                    //var tt = (DataStore.Instance.DS.PersonNameData.Where(x => x.Value.GSurName.GetPrimarySurname == "Ainger"));
                    //if (tt.Count() > 0)
                    //{
                    //}

                    // Create a HLink to the model
                    HLinkPersonNameModel newHlink = new HLinkPersonNameModel
                    {
                        HLinkKey = newPersonNameModel.HLinkKey
                    };

                    t.Add(newHlink);
                }
            }

            // Do not sort as the source file order is the one the creator wanted

            return(t);
        }
        private PersonNameModelCollection GetPersonNameCollection(XElement xmlData)
        {
            PersonNameModelCollection t = new PersonNameModelCollection();

            var theERElement =
                from orElementEl
                in xmlData.Elements(ns + "name")
                select orElementEl;

            if (theERElement.Any())
            {
                // Load attribute object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    // TODO is date handling correct
                    PersonNameModel newPersonNameModel = new PersonNameModel
                    {
                        Handle = "PersonNameCollection",

                        GCitationRefCollection = GetCitationCollection(theLoadORElement),

                        GDate = SetDate(theLoadORElement),

                        GDisplay = GetElement(theLoadORElement, "display"),

                        GFamilyNick = GetElement(theLoadORElement, "familynick"),

                        GFirstName = GetElement(theLoadORElement, "first"),

                        GGroup = GetElement(theLoadORElement, "group"),

                        GNick = GetElement(theLoadORElement, "nick"),

                        GPriv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))),

                        GSort = GetElement(theLoadORElement, "sort"),

                        GSuffix = GetElement(theLoadORElement, "suffix"),

                        GSurName = GetSurnameCollection(theLoadORElement),

                        GTitle = GetElement(theLoadORElement, "title"),

                        GType = GetAttribute(theLoadORElement.Attribute("type")),

                        GNoteReferenceCollection = GetNoteCollection(theLoadORElement),
                    };

                    newPersonNameModel.GAlt.SetAlt(GetAttribute(theLoadORElement, "alt"));

                    // set the Home image or symbol
                    newPersonNameModel.HomeImageHLink.HomeImageType = CommonConstants.HomeImageTypeSymbol;
                    newPersonNameModel.HomeImageHLink.HomeSymbol    = CommonConstants.IconAttribute;

                    t.Add(newPersonNameModel);
                }
            }

            // Return sorted by the default text
            t.Sort(T => T.DeRef.GetDefaultText);

            return(t);
        }