1
0
Fork 0
mirror of https://github.com/oMaN-Rod/nxDumpFuse.git synced 2024-11-26 04:02:18 +00:00

Add log clear function

This commit is contained in:
Omar 2021-10-28 17:54:10 -04:00
parent b38fd516de
commit cfcadc80b0
2 changed files with 42 additions and 19 deletions

View file

@ -22,6 +22,7 @@ namespace nxDumpFuse.ViewModels
SelectOutputFolderCommand = ReactiveCommand.Create(SelectOutputFolder); SelectOutputFolderCommand = ReactiveCommand.Create(SelectOutputFolder);
FuseCommand = ReactiveCommand.Create(FuseNxDump); FuseCommand = ReactiveCommand.Create(FuseNxDump);
StopCommand = ReactiveCommand.Create(StopDump); StopCommand = ReactiveCommand.Create(StopDump);
ClearLogCommand = ReactiveCommand.Create(ClearLog);
ProgressPartText = "Part 0/0"; ProgressPartText = "Part 0/0";
} }
@ -29,11 +30,14 @@ namespace nxDumpFuse.ViewModels
public ReactiveCommand<Unit, Unit> SelectOutputFolderCommand { get; } public ReactiveCommand<Unit, Unit> SelectOutputFolderCommand { get; }
public ReactiveCommand<Unit, Unit> ClearLogCommand { get; }
public ReactiveCommand<Unit, Unit> FuseCommand { get; } public ReactiveCommand<Unit, Unit> FuseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ReactiveCommand<Unit, Unit> StopCommand { get; }
private string _inputFilePath = string.Empty; private string _inputFilePath = string.Empty;
public string InputFilePath public string InputFilePath
{ {
get => _inputFilePath; get => _inputFilePath;
@ -41,6 +45,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _outputDir = string.Empty; private string _outputDir = string.Empty;
public string OutputDir public string OutputDir
{ {
get => _outputDir; get => _outputDir;
@ -48,6 +53,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _progressPartText = string.Empty; private string _progressPartText = string.Empty;
public string ProgressPartText public string ProgressPartText
{ {
get => _progressPartText; get => _progressPartText;
@ -55,6 +61,7 @@ namespace nxDumpFuse.ViewModels
} }
private double _progressPart; private double _progressPart;
public double ProgressPart public double ProgressPart
{ {
get => _progressPart; get => _progressPart;
@ -62,6 +69,7 @@ namespace nxDumpFuse.ViewModels
} }
private double _progress; private double _progress;
public double Progress public double Progress
{ {
get => _progress; get => _progress;
@ -69,6 +77,7 @@ namespace nxDumpFuse.ViewModels
} }
private ObservableCollection<FuseSimpleLog> _logItems = new(); private ObservableCollection<FuseSimpleLog> _logItems = new();
public ObservableCollection<FuseSimpleLog> LogItems public ObservableCollection<FuseSimpleLog> LogItems
{ {
get => _logItems; get => _logItems;
@ -104,6 +113,11 @@ namespace nxDumpFuse.ViewModels
_fuse?.StopFuse(); _fuse?.StopFuse();
} }
private void ClearLog()
{
LogItems.Clear();
}
private void OnFuseUpdate(FuseUpdateInfo fuseUpdateInfo) private void OnFuseUpdate(FuseUpdateInfo fuseUpdateInfo)
{ {
ProgressPart = fuseUpdateInfo.ProgressPart; ProgressPart = fuseUpdateInfo.ProgressPart;

View file

@ -37,7 +37,12 @@
<Expander Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" <Expander Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2"
Header="Log" Header="Log"
Margin="2"> Margin="2">
<DataGrid <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0"
x:Name="FuseSimpleLog" x:Name="FuseSimpleLog"
Items="{Binding LogItems}" Items="{Binding LogItems}"
CanUserSortColumns="False" CanUserSortColumns="False"
@ -55,6 +60,10 @@
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="Auto" FontSize="12" /> <DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="Auto" FontSize="12" />
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button Grid.Column="1" Command="{Binding ClearLogCommand}" Content="Clear" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center" VerticalAlignment="Top" Margin="4" />
</Grid>
</Expander> </Expander>
</Grid> </Grid>
</DockPanel> </DockPanel>