public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
{
try
{
if (direction == PageLoadedDirection.Forward)
{
if (!AllSelectedHostsConnected())
{
foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
row.UpdateIcon();
dataGridViewHosts.Invalidate();
cancel = true;
return;
}
//Upload the patches to the masters if it is necessary
List<Host> masters = SelectedMasters;
//Do RBAC check
foreach (Host master in masters)
{
if (!(Role.CanPerform(new RbacMethodList("pool_patch.apply"), master.Connection)))
{
string nameLabel = master.Name;
Pool pool = Helpers.GetPoolOfOne(master.Connection);
if (pool != null)
nameLabel = pool.Name;
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.RBAC_UPDATES_WIZARD, master.Connection.Username, nameLabel), Messages.UPDATES_WIZARD)))
{
dlg.ShowDialog(this);
}
cancel = true;
base.PageLeave(direction, ref cancel);
return;
}
}
}
base.PageLeave(direction, ref cancel);
}
catch (Exception e)
{
log.Debug(e);
throw;//better throw an exception rather than closing the wizard suddenly and silently
}
}