Fix go to address UX in RAM Search
This commit is contained in:
parent
f599b33ee2
commit
2bb63c2bf1
|
@ -927,32 +927,31 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Message = "Enter a hexadecimal value"
|
Message = "Enter a hexadecimal value"
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = prompt.ShowHawkDialog();
|
while (prompt.ShowHawkDialog() == DialogResult.OK)
|
||||||
|
|
||||||
if (result == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
if (prompt.PromptText.IsHex())
|
try
|
||||||
{
|
{
|
||||||
int addr;
|
var addr = int.Parse(prompt.PromptText, NumberStyles.HexNumber);
|
||||||
try
|
|
||||||
{
|
|
||||||
addr = int.Parse(prompt.PromptText, NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
catch (OverflowException e)
|
|
||||||
{
|
|
||||||
//TODO repeat dialog `prompt` / show error?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = 0; index < _searches.Count; index++)
|
for (int index = 0; index < _searches.Count; index++)
|
||||||
{
|
{
|
||||||
if (addr == _searches[index].Address)
|
if (_searches[index].Address == addr)
|
||||||
{
|
{
|
||||||
WatchListView.SelectItem(index, true);
|
WatchListView.SelectItem(index, true);
|
||||||
WatchListView.ensureVisible();
|
WatchListView.ensureVisible();
|
||||||
break;
|
return; // Don't re-show dialog on success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//TODO add error text to dialog?
|
||||||
|
// Re-show dialog if the address isn't found
|
||||||
|
}
|
||||||
|
catch (FormatException e)
|
||||||
|
{
|
||||||
|
// Re-show dialog if given invalid text (shouldn't happen)
|
||||||
|
}
|
||||||
|
catch (OverflowException e)
|
||||||
|
{
|
||||||
|
//TODO add error text to dialog?
|
||||||
|
// Re-show dialog if the address isn't valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue