1
0
Fork 0
mirror of https://github.com/oMaN-Rod/nxDumpFuse.git synced 2024-11-22 10:16:40 +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);
FuseCommand = ReactiveCommand.Create(FuseNxDump);
StopCommand = ReactiveCommand.Create(StopDump);
ClearLogCommand = ReactiveCommand.Create(ClearLog);
ProgressPartText = "Part 0/0";
}
@ -29,11 +30,14 @@ namespace nxDumpFuse.ViewModels
public ReactiveCommand<Unit, Unit> SelectOutputFolderCommand { get; }
public ReactiveCommand<Unit, Unit> ClearLogCommand { get; }
public ReactiveCommand<Unit, Unit> FuseCommand { get; }
public ReactiveCommand<Unit, Unit> StopCommand { get; }
private string _inputFilePath = string.Empty;
public string InputFilePath
{
get => _inputFilePath;
@ -41,6 +45,7 @@ namespace nxDumpFuse.ViewModels
}
private string _outputDir = string.Empty;
public string OutputDir
{
get => _outputDir;
@ -48,6 +53,7 @@ namespace nxDumpFuse.ViewModels
}
private string _progressPartText = string.Empty;
public string ProgressPartText
{
get => _progressPartText;
@ -55,6 +61,7 @@ namespace nxDumpFuse.ViewModels
}
private double _progressPart;
public double ProgressPart
{
get => _progressPart;
@ -62,6 +69,7 @@ namespace nxDumpFuse.ViewModels
}
private double _progress;
public double Progress
{
get => _progress;
@ -69,6 +77,7 @@ namespace nxDumpFuse.ViewModels
}
private ObservableCollection<FuseSimpleLog> _logItems = new();
public ObservableCollection<FuseSimpleLog> LogItems
{
get => _logItems;
@ -104,6 +113,11 @@ namespace nxDumpFuse.ViewModels
_fuse?.StopFuse();
}
private void ClearLog()
{
LogItems.Clear();
}
private void OnFuseUpdate(FuseUpdateInfo fuseUpdateInfo)
{
ProgressPart = fuseUpdateInfo.ProgressPart;

View file

@ -37,25 +37,34 @@
<Expander Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2"
Header="Log"
Margin="2">
<DataGrid
x:Name="FuseSimpleLog"
Items="{Binding LogItems}"
CanUserSortColumns="False"
CanUserResizeColumns="True"
CanUserReorderColumns="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
VerticalAlignment="Top"
Height="300"
LoadingRow="FuseSimpleLog_OnLoadingRow">
<DataGrid.Columns>
<DataGridTextColumn Header="Type" Binding="{Binding Type}" Width="Auto"
Foreground="{Binding Color}" FontSize="12" />
<DataGridTextColumn Header="Time" Binding="{Binding Time}" Width="Auto" FontSize="12" />
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="Auto" FontSize="12" />
</DataGrid.Columns>
</DataGrid>
</Expander>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0"
x:Name="FuseSimpleLog"
Items="{Binding LogItems}"
CanUserSortColumns="False"
CanUserResizeColumns="True"
CanUserReorderColumns="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
VerticalAlignment="Top"
Height="300"
LoadingRow="FuseSimpleLog_OnLoadingRow">
<DataGrid.Columns>
<DataGridTextColumn Header="Type" Binding="{Binding Type}" Width="Auto"
Foreground="{Binding Color}" FontSize="12" />
<DataGridTextColumn Header="Time" Binding="{Binding Time}" Width="Auto" FontSize="12" />
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="Auto" FontSize="12" />
</DataGrid.Columns>
</DataGrid>
<Button Grid.Column="1" Command="{Binding ClearLogCommand}" Content="Clear" HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center" VerticalAlignment="Top" Margin="4" />
</Grid>
</Expander>
</Grid>
</DockPanel>