private void timer1_Tick(object sender, EventArgs e) { try { if (fProcessing) { return; } fProcessing = true; if (fGenData) { Libs.GenPriceData(myData.DataStockCode); } fProcessing = false; } catch (Exception er) { fProcessing = false; this.ShowError(er); } }
private void genDataBtn_Click(object sender, EventArgs e) { fGenData = !fGenData; timer1.Enabled = fGenData; timer1.Interval = (int)intervalEd.Value * 1000; if (myData == null) { myData = new AnalysisData(); } myData.DataStockCode = codeEd.Text; genDataBtn.Text = (fGenData ? "Stop" : "Start"); this.ShowMessage(fGenData? "Running" : "Stopped"); if (fGenData) { Libs.Reset(); } codeEd.Enabled = !fGenData; intervalEd.Enabled = !fGenData; }