Check for docking should happen outside the VncView's Pause() method.

Also, use Pascal case for property name to match C# conventions.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2022-02-02 11:13:14 +00:00
parent 3601ada1f6
commit 0c1541985c
4 changed files with 19 additions and 27 deletions

View File

@ -258,7 +258,7 @@ namespace XenAdmin.ConsoleView
{
// the VM we are looking at has gone away. We should redock if necessary, otherwise it
// avoids the destroy (and re-create in the case of dom0) when the tab itself goes.
if (!parentVNCView.isDocked)
if (!parentVNCView.IsDocked)
parentVNCView.DockUnDock();
}
}
@ -477,7 +477,7 @@ namespace XenAdmin.ConsoleView
public void UpdateDockButton()
{
dockButton.Text = parentVNCView.isDocked ? Messages.VNC_UNDOCK : Messages.VNC_REDOCK;
dockButton.Text = parentVNCView.IsDocked ? Messages.VNC_UNDOCK : Messages.VNC_REDOCK;
if (Properties.Settings.Default.DockShortcutKey == 1)
{
dockButton.Text += Messages.VNC_DOCK_ALT_SHIFT_U;
@ -486,7 +486,7 @@ namespace XenAdmin.ConsoleView
{
dockButton.Text += Messages.VNC_DOCK_F11;
}
dockButton.Image = parentVNCView.isDocked ? Images.StaticImages.detach_24 : Images.StaticImages.attach_24;
dockButton.Image = parentVNCView.IsDocked ? Images.StaticImages.detach_24 : Images.StaticImages.attach_24;
}
public void UpdateFullScreenButton()

View File

@ -43,32 +43,24 @@ namespace XenAdmin.ConsoleView
{
private readonly VM source;
private readonly VNCTabView vncTabView;
public Form undockedForm = null;
public Form undockedForm;
/// <summary>
/// Helper boolean to only trigger Resize_End when window is really resized by dragging edges
/// Without this Resize_End is triggered even when window is moved around and not resized
/// </summary>
private bool undockedFormResized = false;
private bool undockedFormResized;
public bool isDocked
{
get
{
return this.undockedForm == null || !this.undockedForm.Visible;
}
}
public bool IsDocked => undockedForm == null || !undockedForm.Visible;
public void Pause()
{
if (vncTabView != null && isDocked)
vncTabView.Pause();
vncTabView?.Pause();
}
public void Unpause()
{
if(vncTabView != null)
vncTabView.Unpause();
vncTabView?.Unpause();
}
public VNCView(VM source, string elevatedUsername, string elevatedPassword)
@ -94,7 +86,7 @@ namespace XenAdmin.ConsoleView
public void DockUnDock()
{
if (this.isDocked)
if (IsDocked)
{
if (this.undockedForm == null)
{
@ -235,7 +227,7 @@ namespace XenAdmin.ConsoleView
private void findConsoleButton_Click(object sender, EventArgs e)
{
if (!this.isDocked)
if (!IsDocked)
undockedForm.BringToFront();
if (undockedForm.WindowState == FormWindowState.Minimized)
undockedForm.WindowState = FormWindowState.Normal;

View File

@ -59,13 +59,13 @@ namespace XenAdmin.Controls
public virtual string HelpID => "TabPageConsole";
public void PauseAllViews()
public void PauseAllDockedViews()
{
// We're going to pause all of our VNCViews here, as this gets called when the VNC tab is not selected.
// The VNCView deals with undocked cases.
foreach (VNCView vncView in vncViews.Values)
vncView.Pause();
{
if (vncView.IsDocked)
vncView.Pause();
}
StartCloseVNCTimer(activeVNCView);
}
@ -82,7 +82,7 @@ namespace XenAdmin.Controls
foreach (VNCView vncView in vncViews.Values)
{
if (vncView != activeVNCView)
if (vncView != activeVNCView && vncView.IsDocked)
vncView.Pause();
}
@ -255,7 +255,7 @@ namespace XenAdmin.Controls
VNCView vncView = vncViews[source];
if (!vncView.isDocked)
if (!vncView.IsDocked)
return;
vncViews.Remove(source);

View File

@ -1925,8 +1925,8 @@ namespace XenAdmin
}
else
{
ConsolePanel.PauseAllViews();
CvmConsolePanel.PauseAllViews();
ConsolePanel.PauseAllDockedViews();
CvmConsolePanel.PauseAllDockedViews();
if (t == TabPageGeneral)
{