|
|
|
@ -70,6 +70,7 @@ public partial class MainForm : Form |
|
|
|
|
|
|
|
|
|
// initialize handlers |
|
|
|
|
this.Load += new EventHandler( this.MainForm_Load ) ; |
|
|
|
|
this.FormClosing += new FormClosingEventHandler( this.MainForm_FormClosing ) ; |
|
|
|
|
this.Resize += new EventHandler( this.MainForm_Resize ) ; |
|
|
|
|
this.mSearchQuery.TextChanged += new EventHandler( this.SearchQuery_TextChanged ) ; |
|
|
|
|
this.mSearchQuery.KeyDown += new KeyEventHandler( this.SearchQuery_KeyDown ) ; |
|
|
|
@ -109,6 +110,22 @@ public partial class MainForm : Form |
|
|
|
|
|
|
|
|
|
private void MainForm_Load( object sender, EventArgs e ) |
|
|
|
|
{ |
|
|
|
|
// restore the window state |
|
|
|
|
string windowStateStr = Program.appConfig.getStringVal( new string[]{"MainWindow","WindowState"} ) ; |
|
|
|
|
if ( windowStateStr != "" ) { |
|
|
|
|
FormWindowState windowState ; |
|
|
|
|
if ( Enum.TryParse( windowStateStr, out windowState ) ) { |
|
|
|
|
DesktopBounds = new Rectangle( |
|
|
|
|
Program.appConfig.getIntVal( new string[]{"MainWindow","X"}, 50 ), |
|
|
|
|
Program.appConfig.getIntVal( new string[]{"MainWindow","Y"}, 50 ), |
|
|
|
|
Program.appConfig.getIntVal( new string[]{"MainWindow","Width"}, MinimumSize.Width ), |
|
|
|
|
Program.appConfig.getIntVal( new string[]{"MainWindow","Height"}, MinimumSize.Height ) |
|
|
|
|
) ; |
|
|
|
|
if ( windowState == FormWindowState.Maximized ) |
|
|
|
|
WindowState = windowState ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// initialize |
|
|
|
|
doMainFormResize( null ) ; |
|
|
|
|
|
|
|
|
@ -117,6 +134,18 @@ public partial class MainForm : Form |
|
|
|
|
loadSearchResults( mChartImages.Values ) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void MainForm_FormClosing( object sender, FormClosingEventArgs e ) |
|
|
|
|
{ |
|
|
|
|
// save the window state |
|
|
|
|
// NOTE: RestoreBounds doesn't work properly under Mono :-/ |
|
|
|
|
Rectangle rc = (WindowState == FormWindowState.Maximized) ? RestoreBounds : DesktopBounds ; |
|
|
|
|
Program.appConfig.setIntVal( new string[]{"MainWindow","X"}, rc.X, false ) ; |
|
|
|
|
Program.appConfig.setIntVal( new string[]{"MainWindow","Y"}, rc.Y, false ) ; |
|
|
|
|
Program.appConfig.setIntVal( new string[]{"MainWindow","Width"}, rc.Width, false ) ; |
|
|
|
|
Program.appConfig.setIntVal( new string[]{"MainWindow","Height"}, rc.Height, false ) ; |
|
|
|
|
Program.appConfig.setStringVal( new string[]{"MainWindow","WindowState"}, WindowState.ToString() ) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void MainForm_Resize( object sender, EventArgs e ) { doMainFormResize( null ) ; } |
|
|
|
|
|
|
|
|
|
private void doMainFormResize( Point? clientMousePos ) |
|
|
|
|