Пример #1
0
        /// <summary>
        /// Load the the new GRAMPS data.
        /// </summary>
        /// <returns>
        /// True if the load is successful or False if not.
        /// </returns>
        public async Task <bool> TriggerLoadGrampsUnZippedFolderAsync()
        {
            _commonNotifications.DataLogEntryAdd("Loading GRAMPS XML unzipped data");
            {
                ClearRepositories();

                bool tt = await _ExternalStorage.DataStorageLoadXML().ConfigureAwait(false);

                if (tt)
                {
                    await _ExternalStorage.LoadXMLDataAsync().ConfigureAwait(false);

                    _commonNotifications.DataLogEntryAdd("Finished loading GRAMPS XML data");

                    IFileInfoEx t = new FileInfoEx(argFileName: Common.Constants.StorageXMLFileName);

                    if (t.Valid)
                    {
                        // Save the current Index File modified date for later checking
                        CommonLocalSettings.SaveLastWriteToSettings(t, Common.Constants.SettingsXMLFileLastDateTimeModified);
                    }

                    UpdateSavedLocalSettings();

                    // save the data in a serial format for next time localEventAggregator.GetEvent<DataSaveSerialEvent>().Publish(null);

                    // let everybody know we have finished loading data
                    App.Current.Services.GetService <IMessenger>().Send(new DataLoadXMLEvent(true));

                    return(true);
                }
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Load the the new GRAMPS data.
        /// </summary>
        /// <returns>
        /// True if the load is successful or False if not.
        /// </returns>
        public async Task <bool> TriggerLoadGRAMPSFileAsync(bool deleteOld)
        {
            IFileInfoEx fileGrampsDataInput = new FileInfoEx(argFileName: Common.Constants.StorageGRAMPSFileName);

            if (fileGrampsDataInput != null)
            {
                if (deleteOld)
                {
                    // TODO fix this
                    //await localStoreFile.DataStorageInitialiseAsync(DataStore.Instance.AD.CurrentDataFolder).ConfigureAwait(false);
                }

                _StoreFile.DecompressGZIP(fileGrampsDataInput);

                // Save the current Index File modified date for later checking

                CommonLocalSettings.SaveLastWriteToSettings(fileGrampsDataInput, Common.Constants.SettingsGPRAMPSFileLastDateTimeModified);
            }

            return(false);
        }