mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 12:08:37 +08:00
Handle case where COM object becomes sepatated from Runtime Callable Wrapper (resizing main window after disconnecting from fit to panel session)
This commit is contained in:
@@ -51,10 +51,35 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
|
||||
public virtual bool SmartSize
|
||||
{
|
||||
get => _rdpClient.AdvancedSettings2.SmartSizing;
|
||||
protected set => _rdpClient.AdvancedSettings2.SmartSizing = value;
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return _rdpClient.AdvancedSettings2.SmartSizing;
|
||||
}
|
||||
catch (System.Runtime.InteropServices.InvalidComObjectException)
|
||||
{
|
||||
// The COM object is separated from its RCW, try reacquiring the RCW or recreating the COM object
|
||||
_rdpClient = new MsRdpClient6NotSafeForScripting();
|
||||
return _rdpClient.AdvancedSettings2.SmartSizing;
|
||||
}
|
||||
}
|
||||
protected set
|
||||
{
|
||||
try
|
||||
{
|
||||
_rdpClient.AdvancedSettings2.SmartSizing = value;
|
||||
}
|
||||
catch (System.Runtime.InteropServices.InvalidComObjectException)
|
||||
{
|
||||
// The COM object is separated from its RCW, try reacquiring the RCW or recreating the COM object
|
||||
_rdpClient = new MsRdpClient6NotSafeForScripting();
|
||||
_rdpClient.AdvancedSettings2.SmartSizing = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual bool Fullscreen
|
||||
{
|
||||
get => _rdpClient.FullScreen;
|
||||
|
||||
Reference in New Issue
Block a user