Merge pull request #202 from GaborApatiNagy/CA-143826

CA-143826: When in Notifications view, the context should be empty
This commit is contained in:
Stephen Turner 2014-09-09 15:44:46 +01:00
commit 1a36ea0531
3 changed files with 23 additions and 0 deletions

View File

@ -109,6 +109,9 @@ namespace XenAdmin.Commands
/// </summary>
public event EventHandler SelectionChanged;
public abstract void SaveAndClearSelection();
public abstract void RestoreSavedSelection();
#region IDisposable Members
/// <summary>

View File

@ -42,6 +42,7 @@ namespace XenAdmin.Commands
internal class SelectionManager : SelectionBroadcaster
{
private SelectedItemCollection _selection = new SelectedItemCollection();
private SelectedItemCollection savedSelection = new SelectedItemCollection();
/// <summary>
/// Sets the main selection for XenCenter.
@ -86,5 +87,20 @@ namespace XenAdmin.Commands
{
SetSelection(Selection);
}
public override void SaveAndClearSelection()
{
savedSelection = new SelectedItemCollection(_selection);
SetSelection(new SelectedItemCollection());
}
public override void RestoreSavedSelection()
{
if (savedSelection != null)
{
SetSelection(new SelectedItemCollection(savedSelection));
savedSelection = null;
}
}
}
}

View File

@ -278,11 +278,15 @@ namespace XenAdmin.Controls.MainWindowControls
{
if (currentMode == NavigationMode.Notifications)
{
SelectionManager.SaveAndClearSelection();
//restore the last selected view
SwitchToNotificationsView(lastNotificationsMode);
}
else
{
SelectionManager.RestoreSavedSelection();
//show the navigationView first and then hide the notificationsView
//to avoid instantaneous appearance of empty panels
navigationView.Visible = true;