示例#1
0
        private void barButtonItem5_ItemClick_1(object sender, ItemClickEventArgs e)
        {
            using (TickerDataDownloadForm dlg = new TickerDataDownloadForm()
            {
                Owner = this
            }) {
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                DownloadCanceled = false;
                TradeHistoryIntensityInfo info = new TradeHistoryIntensityInfo();
                info.DownloadProgressChanged += OnTickerDownloadProgressChanged;
                info.Exchange = Exchange.Get(dlg.TickerInfo.Exchange);
                Crypto.Core.Helpers.TickerDownloadData historyInfo = null;
                ProgressForm         = new DownloadProgressForm();
                ProgressForm.Cancel += (d, ee) => {
                    DownloadCanceled = true;
                };

                Thread t = new Thread(() => {
                    historyInfo = info.DownloadItem(dlg.TickerInfo.Ticker.BaseCurrency, dlg.TickerInfo.Ticker.MarketCurrency);
                    BeginInvoke(new MethodInvoker(() => ProgressForm.Close()));
                });
                t.Start();
                ProgressForm.ShowDialog(this);
                if (DownloadCanceled)
                {
                    XtraMessageBox.Show("Downloading Canceled.");
                    return;
                }
                if (historyInfo == null)
                {
                    XtraMessageBox.Show("Error downloading ticker trade history");
                    return;
                }
                info.Items.Add(historyInfo);
                info.Result.Add(historyInfo);

                StrategyDataForm dataForm = new StrategyDataForm();
                dataForm.Visual = info;
                dataForm.Show();
            }
        }