private void DashboardForm_FormClosing(object sender, FormClosingEventArgs e) { if (this.IsClosing == false) { #if DEBUG if (true) #else DialogResult dialogResult = MessageBox.Show(this, "Are you sure you want to quit all trades and exit Monkey Lightning?", "Exit Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) #endif { this.IsClosing = true; for (int i = 0; i < tradeRowCount; i++) { TradeRowControl trc = tradeRows[i]; trc.Trade.Abort(); } if (DashboardClosing != null) { DashboardClosing(this, EventArgs.Empty); } } else { e.Cancel = true; } } }
void AddTradeRow(Trade trade) { int i = tradeRowCount++; tradeRows[i] = new TradeRowControl(); if (i % 2 == 0) { tradeRows[i].RowColor = Color.LightBlue; } else { tradeRows[i].RowColor = Color.LightGray; } // If we specify a TradeMetrics object for a trade, then the // trade will update it automatically. trade.Metrics = new TradeMetrics(); tradeRows[i].Trade = trade; panelTrades.Controls.Add(tradeRows[i]); trade.NotificationArrived += trade_NotificationArrived; }