mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
Tidied up: the vncScreen should notify the parent vncTab when the rdp warning needs
to be shown. It is complicated to have the one control call a method in the other which checks the state on the first control. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
38ca217bc3
commit
a9a1cd6b9c
1
XenAdmin/ConsoleView/VNCTabView.Designer.cs
generated
1
XenAdmin/ConsoleView/VNCTabView.Designer.cs
generated
@ -24,6 +24,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
if (disposing && vncScreen != null && !vncScreen.IsDisposed)
|
||||
{
|
||||
vncScreen.GpuStatusChanged -= ShowGpuWarningIfRequired;
|
||||
vncScreen.Dispose();
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,8 @@ namespace XenAdmin.ConsoleView
|
||||
log.DebugFormat("'{0}' console: Update power state (on VNCTabView constructor)", this.source.Name);
|
||||
updatePowerState();
|
||||
this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
|
||||
ShowGpuWarningIfRequired();
|
||||
ShowGpuWarningIfRequired(vncScreen.MustConnectRemoteDesktop());
|
||||
vncScreen.GpuStatusChanged += ShowGpuWarningIfRequired;
|
||||
|
||||
if (source.IsControlDomainZero || source.IsHVM && !hasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
|
||||
{
|
||||
@ -1498,10 +1499,9 @@ namespace XenAdmin.ConsoleView
|
||||
inToogleConsoleFocus = false;
|
||||
}
|
||||
|
||||
internal void ShowGpuWarningIfRequired()
|
||||
private void ShowGpuWarningIfRequired(bool mustConnectRemoteDesktop)
|
||||
{
|
||||
dedicatedGpuWarning.Visible = vncScreen != null && (vncScreen.UseVNC || string.IsNullOrEmpty(vncScreen.rdpIP)) &&
|
||||
vncScreen.Source.HasGPUPassthrough && vncScreen.Source.power_state == vm_power_state.Running;
|
||||
dedicatedGpuWarning.Visible = mustConnectRemoteDesktop;
|
||||
}
|
||||
|
||||
internal bool IsVNC
|
||||
|
@ -114,6 +114,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
public event EventHandler UserCancelledAuth;
|
||||
public event EventHandler VncConnectionAttemptCancelled;
|
||||
public event Action<bool> GpuStatusChanged;
|
||||
|
||||
internal readonly VNCTabView parentVNCTabView;
|
||||
|
||||
@ -568,7 +569,14 @@ namespace XenAdmin.ConsoleView
|
||||
RemoteConsole.Activate();
|
||||
}
|
||||
|
||||
parentVNCTabView.ShowGpuWarningIfRequired();
|
||||
if (GpuStatusChanged != null)
|
||||
GpuStatusChanged(MustConnectRemoteDesktop());
|
||||
}
|
||||
|
||||
internal bool MustConnectRemoteDesktop()
|
||||
{
|
||||
return (UseVNC || string.IsNullOrEmpty(rdpIP)) &&
|
||||
Source.HasGPUPassthrough && Source.power_state == vm_power_state.Running;
|
||||
}
|
||||
|
||||
private void SetKeyboardAndMouseCapture(bool value)
|
||||
@ -785,7 +793,13 @@ namespace XenAdmin.ConsoleView
|
||||
}
|
||||
|
||||
if (e.PropertyName == "power_state" || e.PropertyName == "VGPUs")
|
||||
parentVNCTabView.ShowGpuWarningIfRequired();
|
||||
{
|
||||
Program.Invoke(this, () =>
|
||||
{
|
||||
if (GpuStatusChanged != null)
|
||||
GpuStatusChanged(MustConnectRemoteDesktop());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal void imediatelyPollForConsole()
|
||||
|
Loading…
Reference in New Issue
Block a user