/// <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;
            }
        }
        private async Task StartLoad()
        {
            BaseCL.Progress("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();

            SharedSharp.Common.SharedSharpNavigation.NavigateHub();

            await Task.Delay(500);

            App.Current.Services.GetService <IMessenger>().Send(new DataLoadStartEvent(true));
        }
        /// <summary>
        /// Loads the sample data.
        /// </summary>
        public async Task LoadSample()
        {
            BaseCL.Progress("Load sample data");

            CommonRoutines.ListEmbeddedResources();

            // Load Resource
            var assemblyExec = Assembly.GetExecutingAssembly();
            var resourceName = "GrampsView.AnythingElse.SampleData.EnglishTudorHouse.gpkg";

            DataStore.Instance.AD.CurrentInputStream = assemblyExec.GetManifestResourceStream(resourceName);

            DataStore.Instance.AD.CurrentInputStreamPath = "AnythingElse/Sample Data/EnglishTudorHouse.gpkg";

            await StartLoad();
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MediaDetailViewModel"/> class.
 /// </summary>
 /// <param name="iocCommonLogging">
 /// Common logger.
 /// </param>
 /// <param name="iocEventAggregator">
 /// The event aggregator.
 /// </param>
 public MediaDetailViewModel(ISharedLogging iocCommonLogging, IMessenger iocEventAggregator)
     : base(iocCommonLogging)
 {
     BaseCL.Progress("MediaDetailViewModel created");
 }