add a toggle all
This commit is contained in:
parent
93a76bc429
commit
ba9b108e5e
@ -81,7 +81,9 @@
|
||||
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/>
|
||||
</StackPanel>
|
||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
||||
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<ToggleButton x:Name="ToggleAll" Content="Toggle All" Click="ToggleAll_Click" IsChecked="True" IsThreeState="False"/>
|
||||
<Separator Margin="2,0,2,0" />
|
||||
<Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
@ -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))
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user