private HLinkPlaceModelCollection GetPlaceRefCollection(XElement xmlData)
        {
            HLinkPlaceModelCollection t = new HLinkPlaceModelCollection();

            // Load NoteRefs
            var localPlaceElement =
                from ElementEl in xmlData.Elements(ns + "placeref")
                select ElementEl;

            if (localPlaceElement.Any())
            {
                // load note references
                foreach (XElement loadPlaceElement in localPlaceElement)
                {
                    HLinkPlaceModel noteHLink = new HLinkPlaceModel
                    {
                        // object details
                        HLinkKey = GetAttribute(loadPlaceElement.Attribute("hlink")),
                    };

                    // save the object
                    t.Add(noteHLink);
                }
            }

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

            return(t);
        }
        private HLinkPlaceModelCollection GetPlaceRefCollection(XElement xmlData)
        {
            HLinkPlaceModelCollection t = new HLinkPlaceModelCollection
            {
                Title = "Place Collection"
            };

            // Load NoteRefs
            IEnumerable <XElement> localPlaceElement =
                from ElementEl in xmlData.Elements(ns + "placeref")
                select ElementEl;

            if (localPlaceElement.Any())
            {
                // load note references
                foreach (XElement loadPlaceElement in localPlaceElement)
                {
                    HLinkPlaceModel noteHLink = new HLinkPlaceModel
                    {
                        // object details
                        HLinkKey = GetHLinkKey(loadPlaceElement),
                    };

                    // save the object
                    t.Add(noteHLink);
                }
            }

            return(t);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets or sets the public Place ViewModel.
        /// </summary>
        /// <summary>
        /// Handles navigation inwards and sets up the place model parameter.
        /// </summary>
        public override void HandleViewDataLoadEvent()
        {
            HLinkPlaceModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkPlaceModel>(BaseParamsHLink);

            PlaceObject = HLinkObject.DeRef;

            if (PlaceObject != null)
            {
                BaseModelBase = PlaceObject;
                BaseTitleIcon = Constants.IconPlace;

                // TODO Display all details

                BaseDetail.Add(new CardListLineCollection("Place Detail")
                {
                    new CardListLine("Title:", PlaceObject.GPTitle),
                    new CardListLine("Type:", PlaceObject.GType),
                    new CardListLine("Code:", PlaceObject.GCode),
                });

                foreach (HLinkPlaceLocationModel thePlaceLocation in PlaceObject.GLocation)
                {
                    BaseDetail.Add(new CardListLineCollection("Location")
                    {
                        new CardListLine("Street:", thePlaceLocation.DeRef.GStreet),
                        new CardListLine("City:", thePlaceLocation.DeRef.GCity),
                        new CardListLine("County:", thePlaceLocation.DeRef.GCounty),
                        new CardListLine("Locality:", thePlaceLocation.DeRef.GLocality),
                        new CardListLine("Parish:", thePlaceLocation.DeRef.GParish),
                        new CardListLine("State:", thePlaceLocation.DeRef.GState),
                        new CardListLine("Country:", thePlaceLocation.DeRef.GCountry),
                        new CardListLine("Phone:", thePlaceLocation.DeRef.GPhone),
                        new CardListLine("City:", thePlaceLocation.DeRef.GPostal),
                    });
                }

                BaseDetail.Add(new CardListLineCollection("Coordinates")
                {
                    new CardListLine("Lat:", PlaceObject.GCoordLat),
                    new CardListLine("Long:", PlaceObject.GCoordLong),
                });

                BaseDetail.Add(new CardListLineCollection("Place Date Ref")
                {
                    new CardListLine("Date:", HLinkObject.Date.ShortDate),
                });

                // Add Map card
                IMapModel t = PlaceObject.ToMapModel();
                BaseDetail.Add(t.HLink);

                BaseDetail.Add(DV.PlaceDV.GetModelInfoFormatted(PlaceObject));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Organises the place repository.
        /// </summary>
        private static async Task <bool> OrganisePlaceRepository()
        {
            await DataStore.CN.MajorStatusAdd("Organising Place data").ConfigureAwait(false);

            foreach (PlaceModel thePlaceModel in DV.PlaceDV.DataViewData)
            {
                HLinkPlaceModel t = thePlaceModel.HLink;

                // TODO fill this

                // Back Reference Citation HLinks
                foreach (HLinkCitationModel citationRef in thePlaceModel.GCitationRefCollection)
                {
                    DataStore.DS.CitationData[citationRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t));
                }

                // Back Reference Note HLinks
                foreach (HLinkNoteModel noteRef in thePlaceModel.GNoteRefCollection)
                {
                    DataStore.DS.NoteData[noteRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t));
                }

                // Back Reference Media HLinks
                foreach (HLinkMediaModel mediaRef in thePlaceModel.GMediaRefCollection)
                {
                    DataStore.DS.MediaData[mediaRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t));
                }

                // Setup Child Place HLinks
                foreach (HLinkPlaceModel placeRef in thePlaceModel.GPlaceRefCollection)
                {
                    DataStore.DS.PlaceData[placeRef.HLinkKey].PlaceChildCollection.Add(t);
                }

                // Back Reference Tag HLinks
                foreach (HLinkTagModel tagRef in thePlaceModel.GTagRefCollection)
                {
                    DataStore.DS.TagData[tagRef.HLinkKey].BackHLinkReferenceCollection.Add(new HLinkBackLink(t));
                }
            }

            // Now that all of the Enclosed Places have been added
            foreach (PlaceModel thePlaceModel in DV.PlaceDV.DataViewData)
            {
                if (thePlaceModel.PlaceChildCollection.Count > 0)
                {
                    thePlaceModel.PlaceChildCollection.SortAndSetFirst();
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        public async Task LoadEventsAsync()
        {
            _iocCommonNotifications.DataLogEntryAdd("Loading Event data");
            {
                try
                {
                    // Run query
                    var de =
                        from el in localGrampsXMLdoc.Descendants(ns + "event")
                        select el;

                    // get event fields TODO

                    // Loop through results to get the Persons Uri _baseUri = new Uri("ms-appx:///");
                    foreach (XElement pname in de)
                    {
                        EventModel loadEvent = new EventModel();

                        // Event attributes
                        loadEvent.LoadBasics(GetBasics(pname));

                        if (loadEvent.Id == "E0001")
                        {
                        }

                        // Event fields
                        loadEvent.GAttribute = GetAttributeCollection(pname);

                        loadEvent.GCitationRefCollection = GetCitationCollection(pname);

                        loadEvent.GDate = SetDate(pname);

                        loadEvent.GDescription = GetElement(pname.Element(ns + "description"));

                        loadEvent.GMediaRefCollection = await GetObjectCollection(pname).ConfigureAwait(false);

                        loadEvent.GNoteRefCollection = GetNoteCollection(pname);

                        XElement tt = pname.Element(ns + "place");
                        if (!(tt is null))
                        {
                            HLinkPlaceModel t = new HLinkPlaceModel();
                            t.HLinkKey       = GetHLinkKey(tt);
                            loadEvent.GPlace = t;
                        }

                        loadEvent.GTagRefCollection = GetTagCollection(pname);

                        loadEvent.GType = GetElement(pname.Element(ns + "type"));

                        loadEvent.EventType = EventModelType.UNKNOWN;
                        if (Enum.TryParse(loadEvent.GType, out EventModelType loadEventType))
                        {
                            loadEvent.EventType = loadEventType;
                        }

                        // save the event
                        DV.EventDV.EventData.Add(loadEvent);
                    }
                }
                catch (Exception e)
                {
                    // TODO handle this
                    _iocCommonNotifications.DataLogEntryAdd(e.Message);

                    _iocCommonNotifications.NotifyException("LoadEventsAsync", e);

                    throw;
                }
            }

            _iocCommonNotifications.DataLogEntryReplace("Event load complete");
            return;
        }
Exemplo n.º 6
0
        public HLinkBackLink SetBookMarkTarget(string argGTarget, string argGHlink)
        {
            switch (argGTarget)
            {
            case "person":
            {
                HLinkPersonModel p1 = new HLinkPersonModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "family":
            {
                HLinkFamilyModel p1 = new HLinkFamilyModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "event":
            {
                HLinkEventModel p1 = new HLinkEventModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "source":
            {
                HLinkSourceModel p1 = new HLinkSourceModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "citation":
            {
                HLinkCitationModel p1 = new HLinkCitationModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "place":
            {
                HLinkPlaceModel p1 = new HLinkPlaceModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "media":
            {
                HLinkMediaModel p1 = new HLinkMediaModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "repository":
            {
                HLinkRepositoryModel p1 = new HLinkRepositoryModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }

            case "note":
            {
                HLinkNoteModel p1 = new HLinkNoteModel
                {
                    HLinkKey = argGHlink
                };

                return(new HLinkBackLink(p1));
            }
            }

            return(new HLinkBackLink());
        }
Exemplo n.º 7
0
        public static HLinkBackLink SetBookMarkTarget(string argGTarget, HLinkKey argHLinkKey)
        {
            switch (argGTarget)
            {
            case "person":
            {
                HLinkPersonModel p1 = DV.PersonDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "family":
            {
                HLinkFamilyModel p1 = DV.FamilyDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "event":
            {
                HLinkEventModel p1 = DV.EventDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "source":
            {
                HLinkSourceModel p1 = DV.SourceDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "citation":
            {
                HLinkCitationModel p1 = DV.CitationDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "place":
            {
                HLinkPlaceModel p1 = DV.PlaceDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "media":
            {
                HLinkMediaModel p1 = DV.MediaDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "repository":
            {
                HLinkRepositoryModel p1 = DV.RepositoryDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }

            case "note":
            {
                HLinkNoteModel p1 = DV.NoteDV.GetModelFromHLinkKey(argHLinkKey).HLink;

                return(new HLinkBackLink(p1));
            }
            }

            return(new HLinkBackLink());
        }