mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 12:08:37 +08:00
Screenshots correctly taken from windowed tab
Screenshots can be taken from undock tabs, created helper tab singleton class to make it easy to determine the current tab in the DPS - mremote model
This commit is contained in:
@@ -23,7 +23,7 @@ namespace mRemoteNG.UI.Tabs
|
||||
|
||||
private void ConnectionTab_GotFocus(object sender, EventArgs e)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.DebugMsg,"Tab got focused: " + TabText);
|
||||
TabHelper.Instance.CurrentTab = this;
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
|
||||
34
mRemoteV1/UI/Tabs/TabHelper.cs
Normal file
34
mRemoteV1/UI/Tabs/TabHelper.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using mRemoteNG.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace mRemoteNG.UI.Tabs
|
||||
{
|
||||
class TabHelper
|
||||
{
|
||||
private static readonly Lazy<TabHelper> lazyHelper= new Lazy<TabHelper>(() => new TabHelper());
|
||||
|
||||
public static TabHelper Instance { get { return lazyHelper.Value; } }
|
||||
|
||||
private TabHelper()
|
||||
{
|
||||
|
||||
}
|
||||
private ConnectionTab currentTab;
|
||||
public ConnectionTab CurrentTab
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentTab;
|
||||
}
|
||||
set
|
||||
{
|
||||
currentTab = value;
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.DebugMsg, "Tab got focused: " + currentTab.TabText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,9 +723,9 @@ namespace mRemoteNG.UI.Window
|
||||
{
|
||||
cmenTab.Close();
|
||||
Application.DoEvents();
|
||||
var selectedTab = (ConnectionTab)GetInterfaceControl()?.Parent;
|
||||
if (selectedTab == null) return;
|
||||
Windows.ScreenshotForm.AddScreenshot(MiscTools.TakeScreenshot(selectedTab));
|
||||
//var selectedTab = (ConnectionTab)GetInterfaceControl()?.Parent;
|
||||
if (TabHelper.Instance.CurrentTab == null) return;
|
||||
Windows.ScreenshotForm.AddScreenshot(MiscTools.TakeScreenshot(TabHelper.Instance.CurrentTab));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -701,6 +701,7 @@
|
||||
<Compile Include="UI\Tabs\MremoteNGAutoHideStrip.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Tabs\TabHelper.cs" />
|
||||
<Compile Include="UI\TaskDialog\CommandButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user