diff --git a/EliteBGS/MainWindow.xaml b/EliteBGS/MainWindow.xaml
index b580d7e..7bcb0af 100644
--- a/EliteBGS/MainWindow.xaml
+++ b/EliteBGS/MainWindow.xaml
@@ -8,6 +8,12 @@
xmlns:Util="clr-namespace:EliteBGS.Util" d:DataContext="{d:DesignInstance Type=Util:AppConfig}" x:Name="window" x:Class="EliteBGS.MainWindow"
mc:Ignorable="d"
Title="Elite: Dangerous BGS Helper" Height="520" Width="890" Icon="EliteBGS.ico" Closing="window_Closing">
+
+
+
+
@@ -44,20 +50,50 @@
-
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EliteBGS/MainWindow.xaml.cs b/EliteBGS/MainWindow.xaml.cs
index 997c99a..d828f2a 100644
--- a/EliteBGS/MainWindow.xaml.cs
+++ b/EliteBGS/MainWindow.xaml.cs
@@ -11,6 +11,7 @@ using EDPlayerJournal.BGS;
using EDPlayerJournal.Entries;
using EliteBGS.BGS;
using EliteBGS.Util;
+using System.Windows.Forms;
namespace EliteBGS;
@@ -183,7 +184,7 @@ public partial class MainWindow : Window {
}
}
- private void entries_KeyUp(object sender, KeyEventArgs e) {
+ private void entries_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) {
if (e.Key == Key.Delete) {
RemoveCurrentObjective();
}
@@ -312,4 +313,92 @@ public partial class MainWindow : Window {
loadentries?.Close();
loadentries = null;
}
+
+ 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 {
+ System.Windows.Controls.Control? button = sender as System.Windows.Controls.Control;
+ if (button == null || button.DataContext == null) {
+ return null;
+ }
+
+ UITransaction transaction = button.DataContext as UITransaction;
+ if (transaction == null) {
+ return null;
+ }
+
+ return transaction.Transaction as TransactionType;
+ }
+
+ private void Low_Click(object sender, RoutedEventArgs e) {
+ CombatZone transaction = GetTransaction(sender);
+ if (transaction == null) {
+ return;
+ }
+
+ transaction.Grade = "Low";
+ RefreshView();
+ }
+
+ private void Med_Click(object sender, RoutedEventArgs e) {
+ CombatZone transaction = GetTransaction(sender);
+ if (transaction == null) {
+ return;
+ }
+
+ transaction.Grade = "Medium";
+ RefreshView();
+ }
+
+ private void High_Click(object sender, RoutedEventArgs e) {
+ CombatZone transaction = GetTransaction(sender);
+ if (transaction == null) {
+ return;
+ }
+
+ transaction.Grade = "High";
+ RefreshView();
+ }
+
+ private void OnFoot_Click(object sender, RoutedEventArgs e) {
+ CombatZone transaction = GetTransaction(sender);
+ if (transaction == null) {
+ return;
+ }
+
+ transaction.Type = "OnFoot";
+ RefreshView();
+ }
+
+ private void Ship_Click(object sender, RoutedEventArgs e) {
+ CombatZone transaction = GetTransaction(sender);
+ if (transaction == null) {
+ return;
+ }
+
+ transaction.Type = "Ship";
+ RefreshView();
+ }
}
diff --git a/EliteBGS/MinusFortyFiveConverter.cs b/EliteBGS/MinusFortyFiveConverter.cs
new file mode 100644
index 0000000..b5c654b
--- /dev/null
+++ b/EliteBGS/MinusFortyFiveConverter.cs
@@ -0,0 +1,19 @@
+using System.Globalization;
+using System.Windows.Data;
+using System;
+
+namespace EliteBGS;
+
+public class MinusFortyFiveConverter : IValueConverter {
+ ///
+ public object Convert(
+ object value, Type targetType, object parameter, CultureInfo culture) {
+ return (double)value - 45;
+ }
+
+ ///
+ public object ConvertBack(
+ object value, Type targetType, object parameter, CultureInfo culture) {
+ throw new NotSupportedException("Cannot convert back");
+ }
+}