Пример #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);
                }
            }
        }
Пример #2
0
 public static void AddList(InstrumentList list)
 {
     if (InstrumentManager.instrumentLists.Contains(list.Name))
     {
         InstrumentManager.RemoveList(list.Name);
     }
     InstrumentManager.instrumentLists.Add(list.Name, list);
 }
Пример #3
0
 internal static void Add(Instrument instrument)
 {
     InstrumentManager.Instruments.Add(instrument);
     if (InstrumentManager.InstrumentAdded == null)
     {
         return;
     }
     InstrumentManager.InstrumentAdded(new InstrumentEventArgs(instrument));
 }
Пример #4
0
        public static void Remove(string symbol)
        {
            var instrument = InstrumentManager.Instruments[symbol];

            if (instrument == null)
            {
                return;
            }
            InstrumentManager.Remove(instrument);
        }
Пример #5
0
 public static void Remove(Instrument instrument)
 {
     InstrumentManager.Server.Remove(instrument);
     InstrumentManager.Instruments.Remove(instrument);
     if (InstrumentManager.InstrumentRemoved == null)
     {
         return;
     }
     InstrumentManager.InstrumentRemoved(new InstrumentEventArgs(instrument));
 }
Пример #6
0
 public void Save()
 {
     InstrumentManager.Save(this);
 }
Пример #7
0
 public Instrument(string symbol, string securityType) : this()
 {
     this.Symbol       = symbol;
     this.SecurityType = securityType;
     InstrumentManager.Add(this);
 }