[Quantproject-developers] QuantDownloader/Downloader TickerDownloader.cs,1.12,1.13 WebDownloader.cs,
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2004-09-05 13:57:13
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23882/Downloader Modified Files: TickerDownloader.cs WebDownloader.cs Log Message: Changed some messages for the user; cleaned old code Index: WebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/WebDownloader.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** WebDownloader.cs 27 Jun 2004 19:21:42 -0000 1.16 --- WebDownloader.cs 5 Sep 2004 13:57:00 -0000 1.17 *************** *** 48,51 **** --- 48,54 ---- private System.Windows.Forms.RadioButton radioButtonDownloadBeforeMinAndAfterMax; private System.Windows.Forms.RadioButton radioButtonDownloadOnlyAfterMax; + private System.Windows.Forms.Button buttonAbort; + private Thread downloadThread = null; + /// <summary> /// Required designer variable. *************** *** 112,115 **** --- 115,119 ---- this.radioButtonDownloadOnlyAfterMax.Checked = true; this.dataGrid1.ContextMenu = new TickerViewerMenu(this); + //this.downloadThread = new Thread( new ThreadStart( this.downloadQuotes_createTickerDataSet)); } *************** *** 144,147 **** --- 148,152 ---- this.radioButtonOverWriteNo = new System.Windows.Forms.RadioButton(); this.radioButtonOverWriteYes = new System.Windows.Forms.RadioButton(); + this.buttonAbort = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.groupBoxWebDownloaderOptions.SuspendLayout(); *************** *** 373,376 **** --- 378,391 ---- this.radioButtonOverWriteYes.Text = "Download all quotes, deleting all existing ones in database"; // + // buttonAbort + // + this.buttonAbort.Enabled = false; + this.buttonAbort.Location = new System.Drawing.Point(216, 376); + this.buttonAbort.Name = "buttonAbort"; + this.buttonAbort.TabIndex = 15; + this.buttonAbort.Text = "Abort"; + this.buttonAbort.Visible = false; + this.buttonAbort.Click += new System.EventHandler(this.buttonAbort_Click); + // // WebDownloader // *************** *** 378,381 **** --- 393,397 ---- this.ClientSize = new System.Drawing.Size(840, 470); this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.buttonAbort, this.groupBoxUpdateDatabaseOptions, this.groupBoxWebDownloaderOptions, *************** *** 568,592 **** private void downloadQuotes_withTickerDataSet( DataSet ds ) { ! downloadQuotes_withTickerDataSet_create_dsTickerCurrentlyDownloaded( ds.Tables[0] ); ! foreach (DataRow myRow in ds.Tables[0].Rows) ! { ! //if (this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Count>5) ! // Monitor.Wait( this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ); ! TickerDownloader qd = new TickerDownloader( this , myRow , myRow["tiTicker"].ToString() , ds.Tables[0].Rows.Count ); ! //Thread newThread = new Thread( new ThreadStart( qd.downloadTicker)); ! //newThread.Start(); ! if(this.radioButtonAllAvailableUntilNowSinceStartingDate.Checked) ! { ! qd.DownloadTicker(this.dateTimePickerStartingDate.Value); ! } ! else { ! qd.DownloadTicker(); } - //newThread.Join(); - //qd.downloadTicker(); - } - //ImportQuotesCsv iqc = new ImportQuotesCsv(); } --- 584,609 ---- private void downloadQuotes_withTickerDataSet( DataSet ds ) { ! ! downloadQuotes_withTickerDataSet_create_dsTickerCurrentlyDownloaded( ds.Tables[0] ); ! foreach (DataRow myRow in ds.Tables[0].Rows) { ! //if (this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Count>5) ! // Monitor.Wait( this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ); ! TickerDownloader qd = new TickerDownloader( this , myRow , myRow["tiTicker"].ToString() , ds.Tables[0].Rows.Count ); ! //Thread newThread = new Thread( new ThreadStart( qd.downloadTicker)); ! //newThread.Start(); ! if(this.radioButtonAllAvailableUntilNowSinceStartingDate.Checked) ! { ! qd.DownloadTicker(this.dateTimePickerStartingDate.Value); ! } ! else ! { ! qd.DownloadTicker(); ! } ! ! //newThread.Join(); ! //qd.downloadTicker(); } } *************** *** 599,606 **** private void downloadQuotesOfAllTickers() { ! DataSet ds=new DataSet(); ! downloadQuotes_createTickerDataSet( ds ); ! downloadQuotes_withTickerDataSet( ds ); ! this.OleDbConnection1.Close(); } --- 616,636 ---- private void downloadQuotesOfAllTickers() { ! try ! { ! DataSet ds=new DataSet(); ! downloadQuotes_createTickerDataSet( ds ); ! downloadQuotes_withTickerDataSet( ds ); ! this.OleDbConnection1.Close(); ! } ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } ! ! finally ! { ! ! } ! } *************** *** 608,616 **** private void downloadQuotesOfSelectedTickers() { ! DataSet ds=new DataSet(); ! ds.Tables.Add(this.tableOfSelectedTickers); ! downloadQuotes_withTickerDataSet( ds ); ! this.OleDbConnection1.Close(); ! } private void openDbAndSetOleDbCommand() --- 638,660 ---- private void downloadQuotesOfSelectedTickers() { ! try ! { ! DataSet ds=new DataSet(); ! ds.Tables.Add(this.tableOfSelectedTickers); ! downloadQuotes_withTickerDataSet( ds ); ! this.OleDbConnection1.Close(); ! } ! ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } ! ! finally ! { ! ! } ! } ! private void openDbAndSetOleDbCommand() *************** *** 641,659 **** private void button1_Click(object sender, System.EventArgs e) { ! //Cursor.Current = Cursors.WaitCursor; this.openDbAndSetOleDbCommand(); this.downloadQuotesOfAllTickers(); ! this.button1.Enabled = false; ! //Cursor.Current = Cursors.Default; ! } private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! //Cursor.Current = Cursors.WaitCursor; this.openDbAndSetOleDbCommand(); this.downloadQuotesOfSelectedTickers(); ! this.buttonDownloadQuotesOfSelectedTickers.Enabled = false; ! //Cursor.Current = Cursors.Default; } --- 685,706 ---- private void button1_Click(object sender, System.EventArgs e) { ! this.button1.Enabled = false; ! this.buttonAbort.Enabled = true; this.openDbAndSetOleDbCommand(); + //this.downloadThread = new Thread( new ThreadStart(this.downloadQuotesOfAllTickers)); + //this.downloadThread.Start(); this.downloadQuotesOfAllTickers(); ! this.buttonAbort.Enabled = false; } private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! this.buttonDownloadQuotesOfSelectedTickers.Enabled = false; ! this.buttonAbort.Enabled = true; this.openDbAndSetOleDbCommand(); + //this.downloadThread = new Thread( new ThreadStart(this.downloadQuotesOfSelectedTickers)); + //this.downloadThread.Start(); this.downloadQuotesOfSelectedTickers(); ! this.buttonAbort.Enabled = false; } *************** *** 678,681 **** --- 725,734 ---- } + private void buttonAbort_Click(object sender, System.EventArgs e) + { + this.buttonAbort.Enabled = false; + this.downloadThread.Abort(); + } + public bool IsBeforeAndAfterSelected { Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TickerDownloader.cs 4 Aug 2004 23:04:20 -0000 1.12 --- TickerDownloader.cs 5 Sep 2004 13:57:00 -0000 1.13 *************** *** 398,402 **** this.updateCurrentStatusDatabaseUpdated("YES"); else ! this.updateCurrentStatus("NOT FOUND"); } --- 398,402 ---- this.updateCurrentStatusDatabaseUpdated("YES"); else ! this.updateCurrentStatus("Not found updatable quotes"); } *************** *** 407,412 **** this.commitDownloadedValuesToDatabase(); } - - public void DownloadTicker() --- 407,410 ---- *************** *** 449,480 **** // ticker's quotes are downloaded for the first time or // the user has chosen to download all quotes - - /* - - if(this.numberOfQuotesInDatabase>0 && p_myForm.IsUpdateOptionSelected) - // there are some ticker's quotes in the database and - // the user has chosen to download new quotes (only after last quote - // or both before first quote and after last quote) - { - if(this.p_myForm.IsOnlyAfterLastQuoteSelected) - { - this.downloadTickerAfterLastQuote(); - } - else - { - this.downloadTickerBeforeFirstQuote(); - this.downloadTickerAfterLastQuote(); - } - } - else - // ticker's quotes are downloaded for the first time or - // the user has chosen to download all quotes - { - this.resetStartDateIfNecessary(); - setTimeFrameAndImportTickerForEachTimeFrame(200); - } - - */ } --- 447,451 ---- |