1
0
Fork 0
mirror of https://github.com/oMaN-Rod/nxDumpFuse.git synced 2024-11-08 11:51:49 +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,25 +37,34 @@
<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>
x:Name="FuseSimpleLog" <Grid.ColumnDefinitions>
Items="{Binding LogItems}" <ColumnDefinition Width="*"/>
CanUserSortColumns="False" <ColumnDefinition Width="Auto"/>
CanUserResizeColumns="True" </Grid.ColumnDefinitions>
CanUserReorderColumns="True" <DataGrid Grid.Column="0"
VerticalScrollBarVisibility="Auto" x:Name="FuseSimpleLog"
HorizontalScrollBarVisibility="Auto" Items="{Binding LogItems}"
VerticalAlignment="Top" CanUserSortColumns="False"
Height="300" CanUserResizeColumns="True"
LoadingRow="FuseSimpleLog_OnLoadingRow"> CanUserReorderColumns="True"
<DataGrid.Columns> VerticalScrollBarVisibility="Auto"
<DataGridTextColumn Header="Type" Binding="{Binding Type}" Width="Auto" HorizontalScrollBarVisibility="Auto"
Foreground="{Binding Color}" FontSize="12" /> VerticalAlignment="Top"
<DataGridTextColumn Header="Time" Binding="{Binding Time}" Width="Auto" FontSize="12" /> Height="300"
<DataGridTextColumn Header="Message" Binding="{Binding Message}" Width="Auto" FontSize="12" /> LoadingRow="FuseSimpleLog_OnLoadingRow">
</DataGrid.Columns> <DataGrid.Columns>
</DataGrid> <DataGridTextColumn Header="Type" Binding="{Binding Type}" Width="Auto"
</Expander> 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> </Grid>
</DockPanel> </DockPanel>