mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Find Setting Changes
This commit is contained in:
parent
808d7b00a8
commit
738332dca2
2 changed files with 25 additions and 13 deletions
|
|
@ -4355,10 +4355,10 @@ namespace ServerManagerTool
|
|||
}
|
||||
}
|
||||
|
||||
public void SelectControl(Control control)
|
||||
public bool SelectControl(Control control)
|
||||
{
|
||||
if (control is null)
|
||||
return;
|
||||
if (control is null || control.Visibility != Visibility.Visible)
|
||||
return false;
|
||||
|
||||
bool focused = false;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
|
|
@ -4403,6 +4403,8 @@ namespace ServerManagerTool
|
|||
|
||||
_lastFoundControl = control;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void UnselectControl()
|
||||
|
|
|
|||
|
|
@ -61,8 +61,9 @@ namespace ServerManagerTool
|
|||
|
||||
_serverSettingsControl.UnselectControl();
|
||||
|
||||
var findSettingString = FindSettingString.Trim();
|
||||
var foundControls = _settingControls
|
||||
.Where(s => s.setting.Contains(FindSettingString, StringComparison.OrdinalIgnoreCase))
|
||||
.Where(s => s.setting.Contains(findSettingString, StringComparison.OrdinalIgnoreCase))
|
||||
.Select(s => s.control)
|
||||
.ToArray();
|
||||
if (foundControls.Length == 0)
|
||||
|
|
@ -72,16 +73,25 @@ namespace ServerManagerTool
|
|||
}
|
||||
|
||||
var oldIndex = _controlIndex;
|
||||
var newIndex = oldIndex + 1;
|
||||
if (newIndex >= foundControls.Length)
|
||||
{
|
||||
_controlIndex = -1;
|
||||
MessageBox.Show(string.Format(_globalizer.GetResourceString("FindSettingWindow_NotFoundErrorLabel"), FindSettingString), _globalizer.GetResourceString("FindSettingWindow_Title"), MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
var newIndex = oldIndex;
|
||||
|
||||
_serverSettingsControl.SelectControl(foundControls[newIndex]);
|
||||
_controlIndex = newIndex;
|
||||
while (true)
|
||||
{
|
||||
newIndex += 1;
|
||||
if (newIndex >= foundControls.Length)
|
||||
{
|
||||
_controlIndex = -1;
|
||||
MessageBox.Show(string.Format(_globalizer.GetResourceString("FindSettingWindow_NotFoundErrorLabel"), FindSettingString), _globalizer.GetResourceString("FindSettingWindow_Title"), MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var selected = _serverSettingsControl.SelectControl(foundControls[newIndex]);
|
||||
if (selected)
|
||||
{
|
||||
_controlIndex = newIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue