mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Name explicitly the control to be focused on page load. No need to search through all the controls of the page.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
1b35a6898f
commit
501970dec5
@ -158,45 +158,6 @@ namespace XenAdmin.Core
|
||||
f.Activate();
|
||||
}
|
||||
|
||||
public static bool FocusFirstControl(Control.ControlCollection cc)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
List<Control> controls = new List<Control>();
|
||||
foreach (Control control in cc)
|
||||
controls.Add(control);
|
||||
controls.Sort((c1, c2) => c1.TabIndex.CompareTo(c2.TabIndex));
|
||||
if (controls.Count > 0)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
{
|
||||
if (control.HasChildren)
|
||||
{
|
||||
found = FocusFirstControl(control.Controls);
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
if (control is Label)
|
||||
continue;
|
||||
|
||||
if (control is TextBox && (control as TextBox).ReadOnly)
|
||||
continue;
|
||||
|
||||
if (control.CanSelect)
|
||||
{
|
||||
found = control.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
public static Dictionary<Host, Host> CheckHostIQNsDiffer()
|
||||
{
|
||||
Dictionary<Host, string> hosts = new Dictionary<Host, string>();
|
||||
|
@ -32,7 +32,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using XenAdmin.Controls;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
@ -56,11 +55,6 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
|
||||
return Details.Valid;
|
||||
}
|
||||
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
}
|
||||
|
||||
protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
|
||||
{
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
|
@ -66,7 +66,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
|
||||
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
comboInterfaces.Focus();
|
||||
}
|
||||
|
||||
public override void PopulatePage()
|
||||
|
@ -68,7 +68,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
|
||||
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
comboBoxNICList.Focus();
|
||||
}
|
||||
|
||||
public override void PopulatePage()
|
||||
|
@ -61,7 +61,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages
|
||||
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
txtName.Focus();
|
||||
}
|
||||
|
||||
protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
|
||||
|
@ -122,7 +122,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
|
||||
HelpersGUI.PerformIQNCheck();
|
||||
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
textBoxIscsiHost.Focus();
|
||||
}
|
||||
|
||||
protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
|
||||
|
@ -109,7 +109,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
NfsServerPathComboBox.Focus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -74,7 +74,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
protected override void PageLoadedCore(PageLoadedDirection direction)
|
||||
{
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
HelpersGUI.FocusFirstControl(Controls);
|
||||
textBoxName.Focus();
|
||||
}
|
||||
|
||||
public override void PopulatePage()
|
||||
|
Loading…
Reference in New Issue
Block a user