Esempio n. 1
0
        /// <summary>
        /// load events from external storage.
        /// </summary>
        /// <param name="eventRepository">
        /// The event repository.
        /// </param>
        /// <returns>
        /// Flag of loaded successfully.
        /// </returns>
        public async Task LoadNameMapsAsync()
        {
            await DataStore.CN.MajorStatusAdd(nameof(LoadNameMapsAsync)).ConfigureAwait(false);

            {
                // XNamespace ns = grampsXMLNameSpace;
                try
                {
                    // Run query
                    var de =
                        from el in localGrampsXMLdoc.Descendants(ns + "namemaps")
                        select el;

                    // get Citation fields

                    // Loop through results to get the Citation Uri _baseUri = new Uri("ms-appx:///");
                    foreach (XElement pcitation in de)
                    {
                        NameMapModel loadNameMap = DV.NameMapDV.NewModel();

                        // Citation attributes
                        loadNameMap.Id     = (string)pcitation.Attribute("id");
                        loadNameMap.Change = GetDateTime(pcitation, "change");
                        loadNameMap.Priv   = SetPrivateObject((string)pcitation.Attribute("priv"));
                        loadNameMap.Handle = (string)pcitation.Attribute("handle");

                        // Citation fields

                        // Don't sort here as the objects pointed to may not have been loaded. Sort
                        // in Post Load cleanup

                        // set the Home image or symbol
                        loadNameMap.HomeImageHLink.HomeImageType = CommonConstants.HomeImageTypeSymbol;
                        loadNameMap.HomeImageHLink.HomeSymbol    = CommonConstants.IconNameMaps;

                        // save the event
                        DV.NameMapDV.NameMapData.Add(loadNameMap);
                    }

                    // sort the collection eventRepository.Items.Sort(EventModel => EventModel);

                    // let everybody know
                }
                catch (Exception e)
                {
                    // TODO handle this
                    await DataStore.CN.MajorStatusAdd(e.Message).ConfigureAwait(false);

                    throw;
                }
            }

            await DataStore.CN.MajorStatusDelete().ConfigureAwait(false);

            return;
        }
Esempio n. 2
0
        public async Task LoadNameMapsAsync()
        {
            _iocCommonNotifications.DataLogEntryAdd("Loading NameMap data");

            {
                // XNamespace ns = grampsXMLNameSpace;
                try
                {
                    // Run query
                    var de =
                        from el in localGrampsXMLdoc.Descendants(ns + "namemaps")
                        select el;

                    // get Citation fields

                    // Loop through results to get the Citation Uri _baseUri = new Uri("ms-appx:///");
                    foreach (XElement pcitation in de)
                    {
                        NameMapModel loadNameMap = new NameMapModel();

                        // Citation attributes
                        loadNameMap.LoadBasics(GetBasics(pcitation));
                        //loadNameMap.Id = (string)pcitation.Attribute("id");
                        //loadNameMap.Change = GetDateTime(pcitation, "change");
                        //loadNameMap.Priv = SetPrivateObject((string)pcitation.Attribute("priv"));
                        //loadNameMap.Handle = (string)pcitation.Attribute("handle");

                        // Citation fields

                        // Don't sort here as the objects pointed to may not have been loaded. Sort
                        // in Post Load cleanup

                        // save the event
                        DV.NameMapDV.NameMapData.Add(loadNameMap);
                    }

                    // sort the collection eventRepository.Items.Sort(EventModel => EventModel);

                    // let everybody know
                }
                catch (Exception e)
                {
                    // TODO handle this
                    _iocCommonNotifications.DataLogEntryAdd(e.Message);

                    throw;
                }
            }

            _iocCommonNotifications.DataLogEntryReplace("NameMap load complete");

            return;
        }