@ -529,25 +529,36 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
#endregion
#endregion
System . Windows . WindowState lastNonMinimizedWindowState = System . Windows . WindowState . Normal ;
Rect restoreBoundsBeforeClosing ;
protected override void OnStateChanged ( EventArgs e )
{
base . OnStateChanged ( e ) ;
if ( this . WindowState ! = System . Windows . WindowState . Minimized )
lastNonMinimizedWindowState = this . WindowState ;
}
public Properties CreateMemento ( )
public Properties CreateMemento ( )
{
{
Properties prop = new Properties ( ) ;
Properties prop = new Properties ( ) ;
prop . Set ( "WindowState" , this . WindowState ) ;
prop . Set ( "WindowState" , lastNonMinimizedWindowState ) ;
if ( this . WindowState = = System . Windows . WindowState . Normal ) {
var bounds = this . RestoreBounds ;
prop . Set ( "Left" , this . Left ) ;
if ( bounds . IsEmpty ) bounds = restoreBoundsBeforeClosing ;
prop . Set ( "Top" , this . Top ) ;
if ( ! bounds . IsEmpty ) {
prop . Set ( "Width" , this . Width ) ;
prop . Set ( "Bounds" , bounds ) ;
prop . Set ( "Height" , this . Height ) ;
}
}
return prop ;
return prop ;
}
}
public void SetMemento ( Properties memento )
public void SetMemento ( Properties memento )
{
{
this . Left = memento . Get ( "Left" , 1 0.0 ) ;
Rect bounds = memento . Get ( "Bounds" , new Rect ( 1 0 , 1 0 , 7 5 0 , 5 5 0 ) ) ;
this . Top = memento . Get ( "Top" , 1 0.0 ) ;
bounds = FormLocationHelper . Validate ( bounds ) ;
this . Width = memento . Get ( "Width" , 6 0 0.0 ) ;
this . Left = bounds . Left ;
this . Height = memento . Get ( "Height" , 4 0 0.0 ) ;
this . Top = bounds . Top ;
this . Width = bounds . Width ;
this . Height = bounds . Height ;
this . WindowState = memento . Get ( "WindowState" , System . Windows . WindowState . Maximized ) ;
this . WindowState = memento . Get ( "WindowState" , System . Windows . WindowState . Maximized ) ;
}
}
@ -574,6 +585,8 @@ namespace ICSharpCode.SharpDevelop.Gui
Project . ProjectService . CloseSolution ( ) ;
Project . ProjectService . CloseSolution ( ) ;
ParserService . StopParserThread ( ) ;
ParserService . StopParserThread ( ) ;
restoreBoundsBeforeClosing = this . RestoreBounds ;
this . WorkbenchLayout = null ;
this . WorkbenchLayout = null ;
foreach ( PadDescriptor padDescriptor in this . PadContentCollection ) {
foreach ( PadDescriptor padDescriptor in this . PadContentCollection ) {