using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using EDJournal; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace EliteBGS { /// /// Interaction logic for LoadEntriesWindow.xaml /// public partial class LoadEntriesWindow : Window { public delegate void EntriesLoadedDelegate(List entries); public event EntriesLoadedDelegate EntriesLoaded; public LoadEntriesWindow() { InitializeComponent(); } private void Load_Click(object sender, RoutedEventArgs e) { string lines = Lines.Text.Trim(); if (lines.Length <= 0) { return; } try { List entries = new List(); foreach (string line in lines.Split('\n')) { Entry entry = Entry.Parse(line); entries.Add(entry); } if (entries.Count > 0) { EntriesLoaded?.Invoke(entries); } } catch (Exception exception) { MessageBox.Show(string.Format("There was an error while parsing the JSON: {0}", exception.ToString())); } } } }