add button that removes unneeded events from test data
This commit is contained in:
parent
9d81a9ad7d
commit
f499d7763b
@ -28,11 +28,13 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button x:Name="Load" Content="Load Entries" Grid.Row="0" Margin="5,5,5,5" Height="Auto" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Load_Click" />
|
<Button x:Name="Load" Content="Load Entries" Grid.Row="0" Margin="5,5,5,5" Height="Auto" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Load_Click" />
|
||||||
<Button x:Name="LoadFile" Content="Load File" Grid.Row="0" Margin="5,5,5,5" Height="Auto" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Click="LoadFile_Click" />
|
<Button x:Name="LoadFile" Content="Load File" Grid.Row="0" Margin="5,5,5,5" Height="Auto" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Click="LoadFile_Click" />
|
||||||
<Button x:Name="Clear" Content="Clear" Grid.Row="0" Height="Auto" Margin="5,5,5,5" Grid.Column="3" Click="Clear_Click" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<Button x:Name="DeleteUnimportant" Content="Remove Unimportant" Grid.Row="0" Margin="5,5,5,5" Height="Auto" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Click="DeleteUnimportant_Click" />
|
||||||
|
<Button x:Name="Clear" Content="Clear" Grid.Row="0" Height="Auto" Margin="5,5,5,5" Grid.Column="4" Click="Clear_Click" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using EDJournal;
|
using EDJournal;
|
||||||
|
using EliteBGS.BGS;
|
||||||
using EliteBGS.Util;
|
using EliteBGS.Util;
|
||||||
|
|
||||||
namespace EliteBGS {
|
namespace EliteBGS {
|
||||||
@ -73,5 +75,36 @@ namespace EliteBGS {
|
|||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteUnimportant_Click(object sender, RoutedEventArgs e) {
|
||||||
|
string lines = Lines.Text.Trim();
|
||||||
|
if (lines.Length <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Entry> entries = new List<Entry>();
|
||||||
|
|
||||||
|
foreach (string line in lines.Split('\n')) {
|
||||||
|
Entry entry = Entry.Parse(line);
|
||||||
|
if (Report.IsRelevant(entry)) {
|
||||||
|
entries.Add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entries.Count <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] text = entries
|
||||||
|
.ConvertAll(x => x.JSON.ToString(Newtonsoft.Json.Formatting.None))
|
||||||
|
.ToArray()
|
||||||
|
;
|
||||||
|
Lines.Text = string.Join("\n", text).Trim();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
MessageBox.Show(string.Format("There was an error while parsing the JSON: {0}",
|
||||||
|
exception.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user