Ejemplo n.º 1
0
        private void DeleteInstruments()
        {
            if (this.trvInstruments.SelectedNode == null)
            {
                return;
            }
            List <Instrument> list = new List <Instrument>();

            if (this.trvInstruments.SelectedNode is GroupNode)
            {
                foreach (InstrumentNode instrumentNode in this.trvInstruments.SelectedNode.Nodes)
                {
                    list.Add(instrumentNode.Instrument);
                }
            }
            if (this.trvInstruments.SelectedNode is InstrumentNode)
            {
                list.Add((this.trvInstruments.SelectedNode as InstrumentNode).Instrument);
            }
            if (MessageBox.Show((IWin32Window)this, "Do you really want to delete selected instrument(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            using (List <Instrument> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    InstrumentManager.Remove(enumerator.Current);
                }
            }
        }
Ejemplo n.º 2
0
        public static void Remove(string symbol)
        {
            var instrument = InstrumentManager.Instruments[symbol];

            if (instrument == null)
            {
                return;
            }
            InstrumentManager.Remove(instrument);
        }