add a select all button

also wished for by Shak
This commit is contained in:
Florian Stinglmayr 2024-04-12 13:48:55 +02:00
parent 34e0a0c8ba
commit 0f44a6a9a7
3 changed files with 24 additions and 3 deletions

View File

@ -160,11 +160,14 @@
<Button x:Name="GenerateDiscord" Content="Generate Discord Report" VerticalAlignment="Stretch" Margin="0,0,0,0" VerticalContentAlignment="Center" Click="GenerateDiscord_Click"/>
<Separator />
<ComboBox x:Name="LogType" VerticalAlignment="Stretch" Margin="0,3,0,3" Width="140" SelectionChanged="LogType_SelectionChanged" />
<Separator />
<CheckBox x:Name="SelectAll" Content="Select All" IsChecked="True" Click="SelectAll_Click"/>
</ToolBar>
<TreeView CheckBox.Checked="TreeView_CheckBox_Updated"
CheckBox.Unchecked="TreeView_CheckBox_Updated"
x:Name="entries" Margin="0,0,0,0"
Grid.ColumnSpan="3" Grid.Row="2"
Grid.ColumnSpan="3"
Grid.Row="2"
KeyUp="entries_KeyUp"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"

View File

@ -557,4 +557,11 @@ public partial class MainWindow : MetroWindow {
} catch (Exception) {
}
}
private void SelectAll_Click(object sender, RoutedEventArgs e) {
if (report == null) {
return;
}
report.SystemObjectives.ForEach(t => { t.IsEnabled = (bool)SelectAll.IsChecked; });
}
}

View File

@ -1,11 +1,22 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using EDPlayerJournal.BGS;
namespace EliteBGS;
public class SystemObjectives {
public bool IsEnabled { get; set; } = true;
public class SystemObjectives : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
private bool isenabled = true;
public bool IsEnabled {
get { return isenabled; }
set {
isenabled = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsEnabled"));
}
}
public bool IsExpanded { get; set; } = false;