diff --git a/EliteBGS/MainWindow.xaml b/EliteBGS/MainWindow.xaml
index 699f0e0..71ea03e 100644
--- a/EliteBGS/MainWindow.xaml
+++ b/EliteBGS/MainWindow.xaml
@@ -81,7 +81,9 @@
-
+
+
+
diff --git a/EliteBGS/MainWindow.xaml.cs b/EliteBGS/MainWindow.xaml.cs
index e60c1bf..b2f2872 100644
--- a/EliteBGS/MainWindow.xaml.cs
+++ b/EliteBGS/MainWindow.xaml.cs
@@ -13,6 +13,7 @@ using EliteBGS.BGS;
using EliteBGS.Util;
using System.Globalization;
using System.Windows.Forms;
+using System.Windows.Controls.Primitives;
namespace EliteBGS;
@@ -217,13 +218,17 @@ public partial class MainWindow : Window {
journal = new PlayerJournal(Config.Global.JournalLocation);
}
- private void AddCombatZone_Click(object sender, RoutedEventArgs e) {
+ private Objective GetObjectiveFromControl(object sender) {
System.Windows.Controls.Control control = sender as System.Windows.Controls.Control;
if (control == null || control.DataContext == null) {
- return;
+ return null;
}
- Objective objective = control.DataContext as Objective;
+ return control.DataContext as Objective;
+ }
+
+ private void AddCombatZone_Click(object sender, RoutedEventArgs e) {
+ Objective objective = GetObjectiveFromControl(sender);
if (objective == null) {
return;
}
@@ -395,4 +400,16 @@ public partial class MainWindow : Window {
enddate.Value = ResetTimeToZero(d.Value);
}
}
+
+ private void ToggleAll_Click(object sender, RoutedEventArgs e) {
+ ToggleButton button = sender as ToggleButton;
+ Objective objective = GetObjectiveFromControl(sender);
+ if (objective == null) {
+ return;
+ }
+
+ objective.UITransactions
+ .ForEach(x => x.IsEnabled = (button.IsChecked ?? true))
+ ;
+ }
}
diff --git a/EliteBGS/Objective.cs b/EliteBGS/Objective.cs
index cd55908..644d5a2 100644
--- a/EliteBGS/Objective.cs
+++ b/EliteBGS/Objective.cs
@@ -6,11 +6,22 @@ using EDPlayerJournal.BGS;
using System.Linq;
using System.Windows;
using EDPlayerJournal;
+using System.ComponentModel;
namespace EliteBGS;
-public class UITransaction {
- public bool IsEnabled { get; set; } = true;
+public class UITransaction : INotifyPropertyChanged {
+ private bool isenabled = true;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public bool IsEnabled {
+ get { return isenabled; }
+ set {
+ isenabled = value;
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsEnabled"));
+ }
+ }
public bool IsExpanded { get; set; } = true;