示例#1
0
        public static async Task ImportArchetypeDecks()
        {
            //construct Progress<T>, passing ReportProgress as the Action<T>
            var progressIndicator = new Progress <Tuple <int, int> >(ReportProgress);

            try
            {
                // TODO: Get back to the IArchetypeImporter interface?
                var importer = new SnapshotImporter(new TrackerRepository());
                var count    = await importer.ImportDecks(
                    Settings.Default.AutoArchiveArchetypes,
                    Settings.Default.DeletePreviouslyImported,
                    Settings.Default.ShortenDeckNames,
                    progressIndicator);

                // Refresh decklist
                Core.MainWindow.LoadAndUpdateDecks();
                Notify("Import complete", $"{count} decks imported", 10);
            }
            catch (Exception e)
            {
                Log.Error(e);
                Notify("Import failed", e.Message, 15, "error");
            }
        }
示例#2
0
        public static async Task ImportMetaDecks()
        {
            try
            {
                IArchetypeImporter importer =
                    new SnapshotImporter(new HttpClient(), new TrackerRepository());
                var count = await importer.ImportDecks(
                    Settings.Default.AutoArchiveArchetypes,
                    Settings.Default.DeletePreviouslyImported,
                    Settings.Default.RemoveClassFromName);

                Notify("Import Complete", $"{count} decks imported", 10);
            }
            catch (Exception e)
            {
                Log.Error(e);
                Notify("Import Failed", e.Message, 15, "error", null);
            }
        }