move log just beneath BGS results

This commit is contained in:
Florian Stinglmayr 2022-11-06 16:23:16 +01:00
parent 19513d50e9
commit 6ed3b1fd10
2 changed files with 23 additions and 60 deletions

View File

@ -22,26 +22,14 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToolBar VerticalAlignment="Top" Grid.Row="0" Width="Auto" Grid.ColumnSpan="3" Height="Auto" Margin="0,0,0,0" HorizontalAlignment="Left">
<Label Content="System:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBox x:Name="system" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown"/>
<Label Content="Station:" Height="26.2857142857143" VerticalAlignment="Top"/>
<TextBox x:Name="station" Margin="0" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown" />
<Label Content="Faction:" Height="26.2857142857143" VerticalAlignment="Top"/>
<TextBox x:Name="faction" Margin="0" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AddFilter" Content="Add Objective" VerticalAlignment="Stretch" Click="AddFilter_Click" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AddCombatZone" Content="Add Combat Zone Win" VerticalAlignment="Stretch" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505" Click="AddCombatZone_Click"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AdjustProfit" Content="Adjust Trade Profit" Margin="0" VerticalAlignment="Stretch" Click="AdjustProfit_Click" />
</ToolBar>
<ToolBar VerticalAlignment="Top" Grid.Row="1" Width="Auto" Margin="0,0,0,0" Height="Auto" Grid.ColumnSpan="3" HorizontalAlignment="Left">
<Button x:Name="ParseJournal" Content="Parse Journal" VerticalAlignment="Center" Click="ParseJournal_Click" HorizontalAlignment="Center"/>
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
@ -51,10 +39,14 @@
<DatePicker x:Name="enddate" Height="26.2857142857143" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
<CheckBox x:Name="collate" Margin="1" Content="Collate entries" IsChecked="True" IsThreeState="False"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AddCombatZone" Content="Add Combat Zone Win" VerticalAlignment="Stretch" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505" Click="AddCombatZone_Click"/>
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
<Button x:Name="AdjustProfit" Content="Adjust Trade Profit" Margin="0" VerticalAlignment="Stretch" Click="AdjustProfit_Click" />
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
</ToolBar>
<TreeView x:Name="entries" Margin="0,0,0,0" Grid.ColumnSpan="3" Grid.Row="2" KeyUp="entries_KeyUp">
<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">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type BGS:Objective}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
@ -78,25 +70,12 @@
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
</Grid>
</TabItem>
<TabItem Header="Discord Report">
<Grid Background="#FFE5E5E5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="53*"/>
<ColumnDefinition Width="385*"/>
<ColumnDefinition Width="438*"/>
</Grid.ColumnDefinitions>
<ToolBar HorizontalAlignment="Left" Height="36" VerticalAlignment="Top" Width="Auto" Grid.ColumnSpan="2">
<ToolBar HorizontalAlignment="Left" Height="36" VerticalAlignment="Top" Width="Auto" Grid.Row="3" Grid.ColumnSpan="2">
<Button x:Name="GenerateDiscord" Content="Generate Discord Report" VerticalAlignment="Center" Margin="0,0,0,4.857" Click="GenerateDiscord_Click" Height="26"/>
<Separator />
<ComboBox x:Name="LogType" Height="36" Margin="0" VerticalAlignment="Center" Width="140" SelectionChanged="LogType_SelectionChanged" />
</ToolBar>
<TextBox x:Name="DiscordLog" Height="Auto" TextWrapping="Wrap" FontFamily="Consolas" FontSize="14" Grid.Row="1" Grid.ColumnSpan="3" AcceptsReturn="True" AcceptsTab="True"/>
<TextBox x:Name="DiscordLog" Height="Auto" TextWrapping="Wrap" FontFamily="Consolas" FontSize="14" Grid.Row="4" Grid.ColumnSpan="3" AcceptsReturn="True" AcceptsTab="True"/>
</Grid>
</TabItem>
<TabItem Header="Settings" HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="53.7142857142857">

View File

@ -68,6 +68,10 @@ namespace EliteBGS {
}
}
private void TreeView_CheckBox_Updated(object sender, RoutedEventArgs args) {
GenerateLog();
}
private void Loadentries_EntriesLoaded(List<Entry> lines) {
try {
report.Scan(lines);
@ -116,6 +120,7 @@ namespace EliteBGS {
var end = enddate.SelectedDate ?? DateTime.Now;
report.Scan(journal, start, end, collate);
RefreshObjectives();
GenerateLog();
} catch (Exception exception) {
Log("Something went terribly wrong while parsing the E:D player journal.");
Log("Please send this to CMDR Hekateh:");
@ -123,29 +128,7 @@ namespace EliteBGS {
}
}
private void AddObjective() {
Objective objective = new Objective {
System = system.Text,
Faction = faction.Text,
Station = station.Text,
ManuallyAdded = true,
};
if (!objective.IsValid) {
return;
}
if (report.AddObjective(objective)) {
RefreshObjectives();
config.SaveObjectives(Report);
}
}
private void AddFilter_Click(object sender, RoutedEventArgs e) {
AddObjective();
}
private void GenerateDiscord_Click(object sender, RoutedEventArgs e) {
private void GenerateLog() {
try {
DiscordLogGenerator discord = LogType.SelectedItem as DiscordLogGenerator;
string report = discord.GenerateDiscordLog(Report);
@ -158,6 +141,10 @@ namespace EliteBGS {
}
}
private void GenerateDiscord_Click(object sender, RoutedEventArgs e) {
GenerateLog();
}
private void RemoveCurrentObjective() {
if (entries.SelectedItem == null) {
return;
@ -179,7 +166,7 @@ namespace EliteBGS {
if (removed) {
RefreshObjectives();
config.SaveObjectives(Report);
GenerateLog();
}
}
@ -201,12 +188,6 @@ namespace EliteBGS {
journal = new PlayerJournal(config.Global.JournalLocation);
}
private void Filter_KeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Enter) {
AddObjective();
}
}
/// <summary>
/// Gets the currently selected objective, even if a log entry in said objective
/// is selected instead. If nothing is selected, returns null.
@ -263,6 +244,7 @@ namespace EliteBGS {
objective.LogEntries.Add(zone);
RefreshObjectives();
GenerateLog();
}
private void AdjustProfit_Click(object sender, RoutedEventArgs e) {
@ -282,6 +264,7 @@ namespace EliteBGS {
if (int.TryParse(adjust.Profit.Text, out int newprofit)) {
sell.Profit = newprofit;
RefreshObjectives();
GenerateLog();
}
}
@ -292,6 +275,7 @@ namespace EliteBGS {
string template = LogType.SelectedItem.ToString();
config.Global.LastUsedDiscordTemplate = template;
GenerateLog();
}
private void ManuallyParse_Click(object sender, RoutedEventArgs e) {