mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +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)
|
if (control is null || control.Visibility != Visibility.Visible)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
bool focused = false;
|
bool focused = false;
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
|
@ -4403,6 +4403,8 @@ namespace ServerManagerTool
|
||||||
|
|
||||||
_lastFoundControl = control;
|
_lastFoundControl = control;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnselectControl()
|
public void UnselectControl()
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,9 @@ namespace ServerManagerTool
|
||||||
|
|
||||||
_serverSettingsControl.UnselectControl();
|
_serverSettingsControl.UnselectControl();
|
||||||
|
|
||||||
|
var findSettingString = FindSettingString.Trim();
|
||||||
var foundControls = _settingControls
|
var foundControls = _settingControls
|
||||||
.Where(s => s.setting.Contains(FindSettingString, StringComparison.OrdinalIgnoreCase))
|
.Where(s => s.setting.Contains(findSettingString, StringComparison.OrdinalIgnoreCase))
|
||||||
.Select(s => s.control)
|
.Select(s => s.control)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
if (foundControls.Length == 0)
|
if (foundControls.Length == 0)
|
||||||
|
|
@ -72,16 +73,25 @@ namespace ServerManagerTool
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldIndex = _controlIndex;
|
var oldIndex = _controlIndex;
|
||||||
var newIndex = oldIndex + 1;
|
var newIndex = oldIndex;
|
||||||
if (newIndex >= foundControls.Length)
|
|
||||||
{
|
|
||||||
_controlIndex = -1;
|
|
||||||
MessageBox.Show(string.Format(_globalizer.GetResourceString("FindSettingWindow_NotFoundErrorLabel"), FindSettingString), _globalizer.GetResourceString("FindSettingWindow_Title"), MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_serverSettingsControl.SelectControl(foundControls[newIndex]);
|
while (true)
|
||||||
_controlIndex = newIndex;
|
{
|
||||||
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue