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); } } }
public static void AddList(InstrumentList list) { if (InstrumentManager.instrumentLists.Contains(list.Name)) { InstrumentManager.RemoveList(list.Name); } InstrumentManager.instrumentLists.Add(list.Name, list); }
internal static void Add(Instrument instrument) { InstrumentManager.Instruments.Add(instrument); if (InstrumentManager.InstrumentAdded == null) { return; } InstrumentManager.InstrumentAdded(new InstrumentEventArgs(instrument)); }
public static void Remove(string symbol) { var instrument = InstrumentManager.Instruments[symbol]; if (instrument == null) { return; } InstrumentManager.Remove(instrument); }
public static void Remove(Instrument instrument) { InstrumentManager.Server.Remove(instrument); InstrumentManager.Instruments.Remove(instrument); if (InstrumentManager.InstrumentRemoved == null) { return; } InstrumentManager.InstrumentRemoved(new InstrumentEventArgs(instrument)); }
public void Save() { InstrumentManager.Save(this); }
public Instrument(string symbol, string securityType) : this() { this.Symbol = symbol; this.SecurityType = securityType; InstrumentManager.Add(this); }