diff --git a/EliteBGS/MainWindow.xaml b/EliteBGS/MainWindow.xaml
index 7bcb0af..e79207f 100644
--- a/EliteBGS/MainWindow.xaml
+++ b/EliteBGS/MainWindow.xaml
@@ -82,7 +82,7 @@
-
+
@@ -93,6 +93,10 @@
+
+
+
+
diff --git a/EliteBGS/MainWindow.xaml.cs b/EliteBGS/MainWindow.xaml.cs
index d828f2a..2948d82 100644
--- a/EliteBGS/MainWindow.xaml.cs
+++ b/EliteBGS/MainWindow.xaml.cs
@@ -315,27 +315,6 @@ public partial class MainWindow : Window {
}
private void Transaction_Initialized(object sender, EventArgs e) {
- Grid grid = sender as Grid;
- if (grid == null || grid.DataContext == null) {
- return;
- }
-
- UITransaction t = grid.DataContext as UITransaction;
- if (t == null) {
- return;
- }
-
- bool iscombatzone = (t.Transaction.GetType() == typeof(CombatZone));
-
- var children = grid
- .Children
- .OfType()
- .Where(x => x.Name == "CombatZone")
- ;
-
- foreach (var child in children ) {
- child.Visibility = (iscombatzone ? Visibility.Visible : Visibility.Collapsed);
- }
}
private TransactionType GetTransaction(object sender) where TransactionType : Transaction {
@@ -401,4 +380,8 @@ public partial class MainWindow : Window {
transaction.Type = "Ship";
RefreshView();
}
+
+ private void Profit_TextChanged(object sender, TextChangedEventArgs e) {
+ RefreshView();
+ }
}
diff --git a/EliteBGS/Objective.cs b/EliteBGS/Objective.cs
index 979f9a7..40fd53e 100644
--- a/EliteBGS/Objective.cs
+++ b/EliteBGS/Objective.cs
@@ -4,6 +4,7 @@ using System.Text;
using Newtonsoft.Json;
using EDPlayerJournal.BGS;
using System.Linq;
+using System.Windows;
namespace EliteBGS;
@@ -12,6 +13,42 @@ public class UITransaction {
public bool IsExpanded { get; set; } = true;
+ public Visibility IsCombatZone {
+ get {
+ return (Transaction != null && Transaction.GetType() == typeof(CombatZone)) ? Visibility.Visible : Visibility.Hidden;
+ }
+ }
+
+ public Visibility IsSellCargo {
+ get {
+ return (Transaction != null && Transaction.GetType() == typeof(SellCargo)) ? Visibility.Visible : Visibility.Hidden;
+ }
+ }
+
+ ///
+ /// Profit from selling, used in the XAML ui for binding
+ ///
+ public string Profit {
+ get {
+ SellCargo cargo = Transaction as SellCargo;
+ if (cargo == null) {
+ return "";
+ }
+ return cargo.Profit.ToString();
+ }
+ set {
+ SellCargo cargo = Transaction as SellCargo;
+ if (cargo == null) {
+ return;
+ }
+ try {
+ long profit_as_number = Convert.ToInt64(value);
+ cargo.Profit = profit_as_number;
+ } catch (FormatException) {
+ }
+ }
+ }
+
public Transaction Transaction { get; set; }
public UITransaction() { }