Compare commits
No commits in common. "0cc8a1f29af00bce92193b9d947cd8c504da192b" and "8d95a4269818aed307bcf60aa1c0ef840f299ee5" have entirely different histories.
0cc8a1f29a
...
8d95a42698
@ -224,12 +224,6 @@ internal class FSDJumpParser : TransactionParserPart {
|
|||||||
throw new InvalidJournalEntryException();
|
throw new InvalidJournalEntryException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you FSD jump straight out of the combat zone into a different system
|
|
||||||
// then the combat zone will be placed in the wrong system otherwise.
|
|
||||||
// This call needs to be *before* changing the current system.
|
|
||||||
context.DiscernCombatZone(transactions, e);
|
|
||||||
context.ResetCombatZone();
|
|
||||||
|
|
||||||
context.CurrentSystem = entry.StarSystem;
|
context.CurrentSystem = entry.StarSystem;
|
||||||
context.CurrentSystemAddress = entry.SystemAddress;
|
context.CurrentSystemAddress = entry.SystemAddress;
|
||||||
|
|
||||||
|
@ -8,12 +8,6 @@
|
|||||||
xmlns:Util="clr-namespace:EliteBGS.Util" d:DataContext="{d:DesignInstance Type=Util:AppConfig}" x:Name="window" x:Class="EliteBGS.MainWindow"
|
xmlns:Util="clr-namespace:EliteBGS.Util" d:DataContext="{d:DesignInstance Type=Util:AppConfig}" x:Name="window" x:Class="EliteBGS.MainWindow"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Elite: Dangerous BGS Helper" Height="520" Width="890" Icon="EliteBGS.ico" Closing="window_Closing">
|
Title="Elite: Dangerous BGS Helper" Height="520" Width="890" Icon="EliteBGS.ico" Closing="window_Closing">
|
||||||
<Window.Resources>
|
|
||||||
<Style x:Key="StretchingTreeViewStyle" TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
||||||
</Style>
|
|
||||||
<local:MinusFortyFiveConverter x:Key="MinusFortyFiveConverter" />
|
|
||||||
</Window.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
@ -50,50 +44,20 @@
|
|||||||
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
|
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
|
||||||
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
|
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
<TreeView CheckBox.Checked="TreeView_CheckBox_Updated"
|
<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" KeyUp="entries_KeyUp">
|
||||||
CheckBox.Unchecked="TreeView_CheckBox_Updated"
|
|
||||||
x:Name="entries" Margin="0,0,0,0"
|
|
||||||
Grid.ColumnSpan="3" Grid.Row="2"
|
|
||||||
KeyUp="entries_KeyUp"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
>
|
|
||||||
<TreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}" ItemsSource="{Binding UITransactions}" ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
<HierarchicalDataTemplate DataType="{x:Type local:Objective}" ItemsSource="{Binding UITransactions}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="{Binding Name}" Margin="5,0" />
|
<TextBlock Text="{Binding Name}" Margin="5,0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<HierarchicalDataTemplate.ItemTemplate>
|
<HierarchicalDataTemplate.ItemTemplate>
|
||||||
<HierarchicalDataTemplate>
|
<HierarchicalDataTemplate>
|
||||||
<!-- This will stretch out the width of the item-->
|
<StackPanel Orientation="Horizontal">
|
||||||
<Grid Initialized="Transaction_Initialized"
|
|
||||||
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" HorizontalAlignment="Stretch">
|
|
||||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="{Binding CompletedAt}" Margin="5,0,5,0" HorizontalAlignment="Right" TextAlignment="Center"/>
|
<TextBlock Text="{Binding CompletedAt}" Margin="5,0,5,0" HorizontalAlignment="Right"/>
|
||||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
|
<TextBlock Text="{Binding Name}" FontWeight="DemiBold"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone">
|
|
||||||
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
|
|
||||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
|
||||||
<Button Content="Med" x:Name="Med" Click="Med_Click" />
|
|
||||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
|
||||||
<Button Content="High" x:Name="High" Click="High_Click"/>
|
|
||||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
|
||||||
<Button Content="On Foot" x:Name="OnFoot" Click="OnFoot_Click"/>
|
|
||||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
|
||||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</HierarchicalDataTemplate.ItemTemplate>
|
</HierarchicalDataTemplate.ItemTemplate>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
|
@ -11,7 +11,6 @@ using EDPlayerJournal.BGS;
|
|||||||
using EDPlayerJournal.Entries;
|
using EDPlayerJournal.Entries;
|
||||||
using EliteBGS.BGS;
|
using EliteBGS.BGS;
|
||||||
using EliteBGS.Util;
|
using EliteBGS.Util;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace EliteBGS;
|
namespace EliteBGS;
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ public partial class MainWindow : Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void entries_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) {
|
private void entries_KeyUp(object sender, KeyEventArgs e) {
|
||||||
if (e.Key == Key.Delete) {
|
if (e.Key == Key.Delete) {
|
||||||
RemoveCurrentObjective();
|
RemoveCurrentObjective();
|
||||||
}
|
}
|
||||||
@ -313,92 +312,4 @@ public partial class MainWindow : Window {
|
|||||||
loadentries?.Close();
|
loadentries?.Close();
|
||||||
loadentries = null;
|
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<StackPanel>()
|
|
||||||
.Where(x => x.Name == "CombatZone")
|
|
||||||
;
|
|
||||||
|
|
||||||
foreach (var child in children ) {
|
|
||||||
child.Visibility = (iscombatzone ? Visibility.Visible : Visibility.Collapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TransactionType GetTransaction<TransactionType>(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<CombatZone>(sender);
|
|
||||||
if (transaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Grade = "Low";
|
|
||||||
RefreshView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Med_Click(object sender, RoutedEventArgs e) {
|
|
||||||
CombatZone transaction = GetTransaction<CombatZone>(sender);
|
|
||||||
if (transaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Grade = "Medium";
|
|
||||||
RefreshView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void High_Click(object sender, RoutedEventArgs e) {
|
|
||||||
CombatZone transaction = GetTransaction<CombatZone>(sender);
|
|
||||||
if (transaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Grade = "High";
|
|
||||||
RefreshView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnFoot_Click(object sender, RoutedEventArgs e) {
|
|
||||||
CombatZone transaction = GetTransaction<CombatZone>(sender);
|
|
||||||
if (transaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Type = "OnFoot";
|
|
||||||
RefreshView();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Ship_Click(object sender, RoutedEventArgs e) {
|
|
||||||
CombatZone transaction = GetTransaction<CombatZone>(sender);
|
|
||||||
if (transaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Type = "Ship";
|
|
||||||
RefreshView();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace EliteBGS;
|
|
||||||
|
|
||||||
public class MinusFortyFiveConverter : IValueConverter {
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public object Convert(
|
|
||||||
object value, Type targetType, object parameter, CultureInfo culture) {
|
|
||||||
return (double)value - 45;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public object ConvertBack(
|
|
||||||
object value, Type targetType, object parameter, CultureInfo culture) {
|
|
||||||
throw new NotSupportedException("Cannot convert back");
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user