CA-85971: Removed method selecting tab by index.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-12-22 15:28:00 +00:00
parent d1c0da5d54
commit d335372575
5 changed files with 22 additions and 19 deletions

View File

@ -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);
}
};

View File

@ -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

View File

@ -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))

View File

@ -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);
}
}

View File

@ -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);