public static ctlPuttyPanel NewPanel(SessionData sessionData)
{
ctlPuttyPanel puttyPanel = null;
// This is the callback fired when the panel containing the terminal is closed
// We use this to save the last docking location
PuttyClosedCallback callback = delegate(bool closed)
{
if (puttyPanel != null)
{
// save the last dockstate (if it has been changed)
if (sessionData.LastDockstate != puttyPanel.DockState
&& puttyPanel.DockState != DockState.Unknown
&& puttyPanel.DockState != DockState.Hidden)
{
sessionData.LastDockstate = puttyPanel.DockState;
SuperPuTTY.SaveSessions();
//sessionData.SaveToRegistry();
}
if (puttyPanel.InvokeRequired)
{
puttyPanel.BeginInvoke((MethodInvoker)delegate()
{
puttyPanel.Close();
});
}
else
{
puttyPanel.Close();
}
}
};
puttyPanel = new ctlPuttyPanel(sessionData, callback);
return puttyPanel;
}