2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00

Merge pull request #11 from fredjk-gh/TheRealPreReadAsReadAll

Make Pre-read act similarly to "Read All"
This commit is contained in:
Xjph 2021-08-17 10:03:01 -02:30 committed by GitHub
commit 254373fe6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 9 deletions

View File

@ -146,7 +146,9 @@ namespace Observatory
// We found an FSD jump, buffered the lines for that system (possibly including startup logs // We found an FSD jump, buffered the lines for that system (possibly including startup logs
// over a file boundary). Pump these through the plugins. // over a file boundary). Pump these through the plugins.
readall = true;
ReportErrors(ProcessLines(lastSystemLines, "Pre-read")); ReportErrors(ProcessLines(lastSystemLines, "Pre-read"));
readall = false;
} }
#endregion #endregion

View File

@ -55,21 +55,15 @@ namespace Observatory.UI.ViewModels
public void ReadAll() public void ReadAll()
{ {
foreach (var worker in workers) SetWorkerReadAllState(true);
{
worker.ReadAllStarted();
}
LogMonitor.GetInstance.ReadAllJournals(); LogMonitor.GetInstance.ReadAllJournals();
foreach (var worker in workers) SetWorkerReadAllState(false);
{
worker.ReadAllFinished();
}
} }
public void ToggleMonitor() public void ToggleMonitor()
{ {
var logMonitor = LogMonitor.GetInstance; var logMonitor = LogMonitor.GetInstance;
if (logMonitor.IsMonitoring()) if (logMonitor.IsMonitoring())
{ {
logMonitor.Stop(); logMonitor.Stop();
@ -77,7 +71,10 @@ namespace Observatory.UI.ViewModels
} }
else else
{ {
// HACK: Find a better way of suppressing notifications when pre-reading.
SetWorkerReadAllState(true);
logMonitor.Start(); logMonitor.Start();
SetWorkerReadAllState(false);
ToggleButtonText = "Stop Monitor"; ToggleButtonText = "Stop Monitor";
} }
} }
@ -123,5 +120,21 @@ namespace Observatory.UI.ViewModels
{ {
get { return tabs; } get { return tabs; }
} }
private void SetWorkerReadAllState(bool isReadingAll)
{
foreach (var worker in workers)
{
if (isReadingAll)
{
worker.ReadAllStarted();
}
else
{
worker.ReadAllFinished();
}
}
}
} }
} }