[Quantproject-developers] QuantDownloader/Downloader Main.cs, 1.9, 1.10
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-07-01 17:45:19
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12279 Modified Files: Main.cs Log Message: The QuantDownloader application now can't be closed if there is a downloading thread in progress Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Main.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Main.cs 1 Dec 2004 22:54:01 -0000 1.9 --- Main.cs 1 Jul 2008 17:45:13 -0000 1.10 *************** *** 6,9 **** --- 6,10 ---- using System.Windows.Forms; using QuantProject.Applications.Downloader.TickerSelectors; + using QuantProject.Applications.Downloader.OpenTickDownloader.UserForms; using QuantProject.Data.Selectors; *************** *** 42,46 **** // InitializeComponent(); ! // // TODO: Add any constructor code after InitializeComponent call --- 43,47 ---- // InitializeComponent(); ! this.Closing += new CancelEventHandler( this.Principale_Closing ); // // TODO: Add any constructor code after InitializeComponent call *************** *** 244,247 **** --- 245,272 ---- } + private bool isSomeDownloadingInProgress() + { + bool returnValue = false; + foreach(Form downloader in Application.OpenForms) + if(downloader is OTWebDownloader) + if( ((OTWebDownloader)downloader).DownloadInProgress ) + returnValue = true; + + return returnValue; + } + + private void Principale_Closing(Object sender, CancelEventArgs e) + { + if ( this.isSomeDownloadingInProgress() ) + { + e.Cancel = true; + MessageBox.Show("You can't close the application if some downloading is still in progress!"); + } + else + { + e.Cancel = false; + } + } + private void menuItem14_Click(object sender, System.EventArgs e) { |