mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CA-85971: Removed method selecting tab by index.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
d1c0da5d54
commit
d335372575
@ -228,18 +228,15 @@ namespace XenAdmin.Alerts
|
||||
return () =>
|
||||
{
|
||||
IXenObject xenObject = null;
|
||||
int tabIndex = 0;
|
||||
|
||||
if (this.XenObject is Host)
|
||||
if (XenObject is Host)
|
||||
{
|
||||
//sr is only set when it's AlarmType.Storage
|
||||
xenObject = sr ?? this.XenObject;
|
||||
tabIndex = 2;
|
||||
xenObject = sr ?? XenObject;
|
||||
}
|
||||
else if (this.XenObject is VM)
|
||||
else if (XenObject is VM)
|
||||
{
|
||||
xenObject = this.XenObject;
|
||||
tabIndex = 5;
|
||||
xenObject = XenObject;
|
||||
}
|
||||
|
||||
if (xenObject == null)
|
||||
@ -247,7 +244,7 @@ namespace XenAdmin.Alerts
|
||||
|
||||
using (var dialog = new PropertiesDialog(xenObject) { TopMost = true })
|
||||
{
|
||||
dialog.SelectTab(tabIndex);
|
||||
dialog.SelectPerfmonAlertEditPage();
|
||||
dialog.ShowDialog(Program.MainWindow);
|
||||
}
|
||||
};
|
||||
|
@ -491,6 +491,20 @@ namespace XenAdmin.Dialogs
|
||||
{
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
#region Select Page methods
|
||||
|
||||
public void SelectPerfmonAlertEditPage()
|
||||
{
|
||||
SelectPage(PerfmonAlertEditPage);
|
||||
}
|
||||
|
||||
public void SelectNewPolicyArchivePage()
|
||||
{
|
||||
SelectPage(newPolicyArchivePage1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class PropertiesDialogClosingEventArgs : EventArgs
|
||||
|
@ -85,14 +85,6 @@ namespace XenAdmin.Dialogs
|
||||
SelectPage(page);
|
||||
}
|
||||
|
||||
public void SelectTab(int selectedTabIndex)
|
||||
{
|
||||
if (selectedTabIndex < 0 || selectedTabIndex >= verticalTabs.Items.Count)
|
||||
return;
|
||||
|
||||
verticalTabs.SelectedIndex = selectedTabIndex;
|
||||
}
|
||||
|
||||
public void SelectPage(VerticalTabs.VerticalTab page)
|
||||
{
|
||||
if (page == null || !verticalTabs.Items.Contains(page))
|
||||
|
@ -1574,7 +1574,7 @@ namespace XenAdmin.TabPages
|
||||
ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes)
|
||||
{
|
||||
var dialog = new PropertiesDialog(vmpp);
|
||||
dialog.SelectTab(4);
|
||||
dialog.SelectNewPolicyArchivePage();
|
||||
dialog.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ namespace XenAdminTests.DialogTests
|
||||
int index = i;
|
||||
MW(() =>
|
||||
{
|
||||
dialog.SelectTab(index);
|
||||
|
||||
var verticalTabs = TestUtils.GetFieldDeep<VerticalTabs>(dialog, "verticalTabs");
|
||||
verticalTabs.SelectedIndex = index;
|
||||
var vtab = dialog.SelectedTab;
|
||||
Assert.IsNotNull(vtab, "Failed to select tab number " + index);
|
||||
Assert.AreEqual(tabNames[index], vtab.Text, "Wrong tabs found at position " + index);
|
||||
|
Loading…
Reference in New Issue
Block a user