Esempio n. 1
0
        /// <summary>
        /// Gramps export XML plus media.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="parameter">
        /// The parameter.
        /// </param>
        public async void PickFile()
        {
            BaseCL.LogProgress("Calling folder picker");

            try
            {
                if (await StoreFileUtility.PickCurrentInputFile().ConfigureAwait(false))
                {
                    BaseCL.LogProgress("Tell someone to load the file");

                    // Remove the old dateTime stamps so the files get reloaded even if they have
                    // been seen before
                    CommonLocalSettings.SetReloadDatabase();

                    BaseEventAggregator.GetEvent <DataLoadStartEvent>().Publish(false);

                    BaseEventAggregator.GetEvent <PageNavigateEvent>().Publish(nameof(MessageLogPage));

                    await DataStore.CN.ChangeLoadingMessage("File picked").ConfigureAwait(false);
                }
                else
                {
                    BaseCL.LogProgress("File picker error");
                    DataStore.CN.NotifyAlert("No input file was selected");

                    // Allow another pick if required
                    LocalCanHandleDataFolderChosen = true;
                }
            }
            catch (Exception ex)
            {
                DataStore.CN.NotifyException("Exception when using File Picker", ex);
            }
        }
        /// <summary>
        /// Gramps export XML plus media.
        /// </summary>
        public async Task PickFile()
        {
            BaseCL.Progress("Calling folder picker");

            try
            {
                BaseCurrentLayoutState = LayoutState.Loading;

                App.Current.Services.GetService <IErrorNotifications>().DataLogEntryReplace("");

                if (await StoreFileUtility.PickCurrentInputFile().ConfigureAwait(false))
                {
                    await StartLoad();
                }
                else
                {
                    BaseCL.Progress("File picker error");
                    App.Current.Services.GetService <IErrorNotifications>().NotifyAlert("No input file was selected");

                    BaseCurrentLayoutState = LayoutState.None;
                }
            }
            catch (Exception ex)
            {
                App.Current.Services.GetService <IErrorNotifications>().NotifyException("Exception when using File Picker", ex);

                throw;
            }
        }