Compare commits
3 Commits
3a5d0a90ef
...
c2037f28e2
Author | SHA1 | Date | |
---|---|---|---|
c2037f28e2 | |||
e6e0233e6d | |||
1a6183ba9d |
@ -1,5 +1,6 @@
|
||||
namespace EDPlayerJournal.BGS;
|
||||
internal class IncompleteTransaction : Transaction {
|
||||
namespace EDPlayerJournal.BGS;
|
||||
|
||||
public class IncompleteTransaction : Transaction {
|
||||
public Transaction? UnderlyingTransaction { get; set; } = null;
|
||||
public string Reason { get; set; } = "";
|
||||
|
||||
|
@ -63,10 +63,16 @@ public partial class MainWindow : Window {
|
||||
GenerateLog();
|
||||
}
|
||||
|
||||
private void Loadentries_EntriesLoaded(List<Entry> lines) {
|
||||
private void HandleEntries(List<Entry> entries) {
|
||||
try {
|
||||
TransactionParser parser = new TransactionParser();
|
||||
List<Transaction> transactions = parser.Parse(lines);
|
||||
List<Transaction> transactions = parser.Parse(entries);
|
||||
|
||||
// Log incomplete and remove them from the results.
|
||||
foreach (var incomplete in transactions.OfType<IncompleteTransaction>()) {
|
||||
Log(incomplete.Reason);
|
||||
transactions.Remove(incomplete);
|
||||
}
|
||||
|
||||
report = new Report(transactions);
|
||||
this.entries.ItemsSource = report.Objectives;
|
||||
@ -77,6 +83,10 @@ public partial class MainWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
private void Loadentries_EntriesLoaded(List<Entry> lines) {
|
||||
HandleEntries(lines);
|
||||
}
|
||||
|
||||
private void Report_OnLog(string message) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@ -122,11 +132,7 @@ public partial class MainWindow : Window {
|
||||
.ToList()
|
||||
;
|
||||
|
||||
List<Transaction> transactions = parser.Parse(entries);
|
||||
report = new Report(transactions);
|
||||
|
||||
this.entries.ItemsSource = report.Objectives;
|
||||
|
||||
HandleEntries(entries);
|
||||
GenerateLog();
|
||||
} catch (Exception exception) {
|
||||
Log("Something went terribly wrong while parsing the E:D player journal.");
|
||||
@ -172,7 +178,7 @@ public partial class MainWindow : Window {
|
||||
}
|
||||
|
||||
if (removed) {
|
||||
GenerateLog();
|
||||
RefreshView();
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,6 +253,11 @@ public partial class MainWindow : Window {
|
||||
};
|
||||
|
||||
objective.Transactions.Add(zone);
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void RefreshView() {
|
||||
entries.Items.Refresh();
|
||||
GenerateLog();
|
||||
}
|
||||
|
||||
@ -266,7 +277,7 @@ public partial class MainWindow : Window {
|
||||
|
||||
if (int.TryParse(adjust.Profit.Text, out int newprofit)) {
|
||||
sell.Profit = newprofit;
|
||||
GenerateLog();
|
||||
RefreshView();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user