sort thumbnails by date in DatasetExplorer

This commit is contained in:
Alex Bezdieniezhnykh
2024-09-29 16:24:31 +03:00
parent 22d4493d86
commit d2186eb326
8 changed files with 182 additions and 108 deletions
+10 -1
View File
@@ -266,7 +266,16 @@ public partial class MainWindow
if (existingResult != null)
_formState.AnnotationResults.Remove(existingResult);
_formState.AnnotationResults.Add(new AnnotationResult(timeValue, fName, annotations, _config));
var dict = _formState.AnnotationResults
.Select((x,i) => new { x.Time, Index = i })
.ToDictionary(x => x.Time, x => x.Index);
var index = dict.Where(x => x.Key < timeValue)
.OrderBy(x => x.Key - timeValue)
.Select(x => x.Value + 1)
.FirstOrDefault();
_formState.AnnotationResults.Insert(index, new AnnotationResult(timeValue, fName, annotations, _config));
await File.WriteAllTextAsync($"{_config.ResultsDirectory}/{fName}.json", JsonConvert.SerializeObject(_formState.AnnotationResults));
}