change layout of tree to go: system / faction / bgs
This was requested by some very special commanders who, after a massive BGS bender, have very long lists in terms of BGS actions taken
This commit is contained in:
parent
b0b82811cc
commit
34e0a0c8ba
@ -9,10 +9,107 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Elite: Dangerous BGS Helper" Height="520" Width="950" Icon="Salus.ico" Closing="window_Closing">
|
||||
<Window.Resources>
|
||||
<local:MinusFortyFiveConverter x:Key="MinusFortyFiveConverter" />
|
||||
<Style x:Key="StretchingTreeViewStyle" TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
<local:MinusFortyFiveConverter x:Key="MinusFortyFiveConverter" />
|
||||
|
||||
<local:Report x:Key="ObjectivesBasedOnSystem" />
|
||||
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:SystemObjectives}" ItemsSource="{Binding Path=Objectives}">
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding SystemName}" FontWeight="DemiBold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}"
|
||||
ItemsSource="{Binding Path=UITransactions}"
|
||||
ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Faction: " Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold"/>
|
||||
</StackPanel>
|
||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
||||
<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>
|
||||
</HierarchicalDataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type local:UITransaction}">
|
||||
<!-- This will stretch out the width of the item-->
|
||||
<Grid Initialized="Transaction_Initialized"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
Margin="0,2,0,2"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CompletedAt}" Margin="2,0,2,0" HorizontalAlignment="Right" TextAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
|
||||
<Expander Header="Optional Objectives" Visibility="{Binding IsShipCombatZone}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCaptain" Margin="2,0,2,0" Content="Allied Captain" IsChecked="{Binding HasAlliedCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCaptain" Margin="2,0,2,0" Content="Enemy Captain" IsChecked="{Binding HasEnemyCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCorrespondent" Margin="2,0,2,0" Content="Allied Correspondent" IsChecked="{Binding HasAlliedCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCorrespondent" Margin="2,0,2,0" Content="Enemy Correspondent" IsChecked="{Binding HasEnemyCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Difficulty">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
|
||||
<Button x:Name="Med" Content="Med" Click="Med_Click"/>
|
||||
<Button x:Name="High" Content="High" Click="High_Click"/>
|
||||
<Button x:Name="VeryHigh" Content="Very High" Click="VeryHigh_Click" />
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Type">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
|
||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
||||
<Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
|
||||
<TextBlock Text="Adjust Profit: " TextAlignment="Center" />
|
||||
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="Profit_LostFocus" KeyUp="Profit_KeyUp"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
</Window.Resources>
|
||||
<mah:MetroWindow.RightWindowCommands>
|
||||
<mah:WindowCommands ShowSeparators="False">
|
||||
@ -71,87 +168,8 @@
|
||||
KeyUp="entries_KeyUp"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
ItemsSource="{Binding Source={StaticResource ObjectivesBasedOnSystem}}"
|
||||
>
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}" ItemsSource="{Binding UITransactions}" ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Visibility="{Binding HasSystem}" Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding System}" FontWeight="DemiBold" Visibility="{Binding HasSystem}"/>
|
||||
<TextBlock Text="Faction: " Visibility="{Binding HasFaction}" Margin="2,0,0,0"/>
|
||||
<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" 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>
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate>
|
||||
<!-- This will stretch out the width of the item-->
|
||||
<Grid Initialized="Transaction_Initialized"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
Margin="0,2,0,2"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CompletedAt}" Margin="2,0,2,0" HorizontalAlignment="Right" TextAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
|
||||
<Expander Header="Optional Objectives" Visibility="{Binding IsShipCombatZone}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCaptain" Margin="2,0,2,0" Content="Allied Captain" IsChecked="{Binding HasAlliedCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCaptain" Margin="2,0,2,0" Content="Enemy Captain" IsChecked="{Binding HasEnemyCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCorrespondent" Margin="2,0,2,0" Content="Allied Correspondent" IsChecked="{Binding HasAlliedCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCorrespondent" Margin="2,0,2,0" Content="Enemy Correspondent" IsChecked="{Binding HasEnemyCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Difficulty">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
|
||||
<Button x:Name="Med" Content="Med" Click="Med_Click"/>
|
||||
<Button x:Name="High" Content="High" Click="High_Click"/>
|
||||
<Button x:Name="VeryHigh" Content="Very High" Click="VeryHigh_Click" />
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Type">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
|
||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
||||
<Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
|
||||
<TextBlock Text="Adjust Profit: " TextAlignment="Center" />
|
||||
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="Profit_LostFocus" KeyUp="Profit_KeyUp"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
|
@ -192,7 +192,7 @@ public partial class MainWindow : MetroWindow {
|
||||
transactions.RemoveAll(x => incompletes.Contains(x));
|
||||
|
||||
report = new Report(transactions);
|
||||
this.entries.ItemsSource = report.Objectives;
|
||||
this.entries.ItemsSource = report.SystemObjectives;
|
||||
} catch (Exception exception) {
|
||||
Log("Something went terribly wrong while parsing the E:D player journal.");
|
||||
Log("Please send this to CMDR Hekateh:");
|
||||
|
@ -242,7 +242,7 @@ public class UITransaction : INotifyPropertyChanged {
|
||||
}
|
||||
|
||||
public class Objective : IComparable<Objective> {
|
||||
public bool IsEnabled { get; set; }
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
public List<UITransaction> UITransactions { get; } = new List<UITransaction>();
|
||||
|
||||
|
@ -1,10 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EDPlayerJournal.BGS;
|
||||
|
||||
namespace EliteBGS;
|
||||
|
||||
public class SystemObjectives {
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
public bool IsExpanded { get; set; } = false;
|
||||
|
||||
public string SystemName { get; set; } = string.Empty;
|
||||
|
||||
public List<Objective> Objectives { get; set; } = new();
|
||||
}
|
||||
|
||||
public class Report {
|
||||
public List<Objective> Objectives { get; set; } = new List<Objective>();
|
||||
public List<SystemObjectives> SystemObjectives { get; set; } = new();
|
||||
|
||||
public Report() { }
|
||||
|
||||
@ -12,29 +23,33 @@ public class Report {
|
||||
Populate(transactions);
|
||||
}
|
||||
|
||||
public List<Objective> Objectives {
|
||||
get {
|
||||
return SystemObjectives
|
||||
.Where(t => t.IsEnabled)
|
||||
.SelectMany(x => x.Objectives)
|
||||
.ToList()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
private void Populate(List<Transaction> transactions) {
|
||||
if (transactions == null || transactions.Count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Transaction t in transactions) {
|
||||
Objective o;
|
||||
if (t.SystemContribution) {
|
||||
o = Objectives.Find(x => x.Matches(t.System));
|
||||
} else {
|
||||
o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
}
|
||||
|
||||
var o = SystemObjectives.Find(x => string.Compare(x.SystemName, t.System) == 0);
|
||||
if (o == null) {
|
||||
if (t.SystemContribution) {
|
||||
o = new Objective() { System = t.System };
|
||||
} else {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
o = new SystemObjectives() { SystemName = t.System };
|
||||
SystemObjectives.Add(o);
|
||||
}
|
||||
Objectives.Add(o);
|
||||
var objective = o.Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
if (objective == null) {
|
||||
objective = new Objective() { Faction = t.Faction, System = t.System };
|
||||
o.Objectives.Add(objective);
|
||||
}
|
||||
|
||||
o.UITransactions.Add(new UITransaction(t));
|
||||
objective.UITransactions.Add(new UITransaction(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user