UI is trying to update selectedIndex during reset. Don't allow that.

This commit is contained in:
Benjamin Popp 2021-07-13 22:51:54 -05:00
parent 5f9eab3e4f
commit afea210867
2 changed files with 9 additions and 1 deletions

View File

@ -23,7 +23,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Tools {
get => selectedVisibleIndex;
set {
if (value == -1) return;
if (selectedVisibleIndex != value) {
if (selectedVisibleIndex != value && !resetting) {
selectedIndex = allOptions.IndexOf(Options[value]);
ResetFilter();
UpdateSelection?.Invoke(this, EventArgs.Empty);

View File

@ -1,6 +1,7 @@
using HavenSoft.HexManiac.Core;
using HavenSoft.HexManiac.Core.Models;
using HavenSoft.HexManiac.Core.Models.Runs;
using HavenSoft.HexManiac.Core.ViewModels;
using HavenSoft.HexManiac.Core.ViewModels.DataFormats;
using HavenSoft.HexManiac.Core.ViewModels.Tools;
using HavenSoft.HexManiac.Core.ViewModels.Visitors;
@ -799,4 +800,11 @@ namespace HavenSoft.HexManiac.Tests {
ViewPort.Goto.Execute("00");
}
}
public static class TableToolTestExtensions {
public static FieldArrayElementViewModel GetField(this TableTool table, string name) {
var child = table.Children.Single(vm => vm is FieldArrayElementViewModel fvm && fvm.Name == name);
return (FieldArrayElementViewModel)child;
}
}
}