void BtnDelete_Click(object sender, EventArgs e)
{
string symbol = lbxInstruments.SelectedItem.ToString();
int index = lbxInstruments.SelectedIndex;
if (symbol == "EURUSD" || symbol == "GBPUSD" ||
symbol == "USDCHF" || symbol == "USDJPY" ||
symbol == Data.Symbol)
{
MessageBox.Show(
Language.T("You cannot delete this instrument!"),
Language.T("Instrument Editor"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
DialogResult dr = MessageBox.Show(
Language.T("Do you want to delete the selected instrument?"),
Language.T("Instrument Editor"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
Instruments.InstrumentList.Remove(symbol);
lbxInstruments.Items.Remove(symbol);
if (index > 0)
lbxInstruments.SelectedIndex = index - 1;
else
lbxInstruments.SelectedIndex = index;
bNeedReset = true;
}
return;
}