mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Hide progress when ROM is imported (reduces RAM usage).
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using RomRepoMgr.Core.EventArgs;
|
using RomRepoMgr.Core.EventArgs;
|
||||||
@@ -12,6 +11,7 @@ public class RomImporter : ReactiveObject
|
|||||||
double _maximum;
|
double _maximum;
|
||||||
double _minimum;
|
double _minimum;
|
||||||
double _progress;
|
double _progress;
|
||||||
|
bool _progressVisible = true;
|
||||||
Color _statusColor;
|
Color _statusColor;
|
||||||
string _statusMessage;
|
string _statusMessage;
|
||||||
public string Filename { get; internal init; }
|
public string Filename { get; internal init; }
|
||||||
@@ -53,6 +53,12 @@ public class RomImporter : ReactiveObject
|
|||||||
set => this.RaiseAndSetIfChanged(ref _statusColor, value);
|
set => this.RaiseAndSetIfChanged(ref _statusColor, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ProgressVisible
|
||||||
|
{
|
||||||
|
get => _progressVisible;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _progressVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
internal void OnErrorOccurred(object sender, ErrorEventArgs e)
|
internal void OnErrorOccurred(object sender, ErrorEventArgs e)
|
||||||
{
|
{
|
||||||
StatusMessage = e.Message;
|
StatusMessage = e.Message;
|
||||||
@@ -88,21 +94,23 @@ public class RomImporter : ReactiveObject
|
|||||||
|
|
||||||
internal void OnWorkFinished(object sender, MessageEventArgs e)
|
internal void OnWorkFinished(object sender, MessageEventArgs e)
|
||||||
{
|
{
|
||||||
Indeterminate = false;
|
Indeterminate = false;
|
||||||
Maximum = 1;
|
Maximum = 1;
|
||||||
Minimum = 0;
|
Minimum = 0;
|
||||||
Progress = 1;
|
Progress = 1;
|
||||||
StatusMessage = e.Message;
|
StatusMessage = e.Message;
|
||||||
Running = false;
|
Running = false;
|
||||||
|
ProgressVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnImportedRom(object sender, ImportedRomItemEventArgs e)
|
public void OnImportedRom(object sender, ImportedRomItemEventArgs e)
|
||||||
{
|
{
|
||||||
Indeterminate = false;
|
Indeterminate = false;
|
||||||
Maximum = 1;
|
Maximum = 1;
|
||||||
Minimum = 0;
|
Minimum = 0;
|
||||||
Progress = 1;
|
Progress = 1;
|
||||||
StatusMessage = e.Item.Status;
|
StatusMessage = e.Item.Status;
|
||||||
Running = false;
|
Running = false;
|
||||||
|
ProgressVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,8 @@
|
|||||||
<ProgressBar Minimum="{Binding Minimum, Mode=OneWay}"
|
<ProgressBar Minimum="{Binding Minimum, Mode=OneWay}"
|
||||||
Maximum="{Binding Maximum, Mode=OneWay}"
|
Maximum="{Binding Maximum, Mode=OneWay}"
|
||||||
Value="{Binding Progress, Mode=OneWay}"
|
Value="{Binding Progress, Mode=OneWay}"
|
||||||
IsIndeterminate="{Binding Indeterminate, Mode=OneWay}" />
|
IsIndeterminate="{Binding Indeterminate, Mode=OneWay}"
|
||||||
|
IsVisible="{Binding ProgressVisible, Mode=OneWay}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
|
|||||||
Reference in New Issue
Block a user