Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <InstrumentBase> ClearAllInstruments()
        {
            List <InstrumentBase> insts = new List <InstrumentBase>();

            try
            {
                InstrumentManager.InstExclusiveLockObject.EnterWriteLock();

                for (int i = instruments.Count - 1; i >= 0; i--)
                {
                    for (int j = instruments[i].Count - 1; j >= 0; j--)
                    {
                        instruments[i][j].Dispose();
                        instruments[i].RemoveAt(j);
                    }
                }
                InstrumentRemoved?.Invoke(typeof(InstrumentManager), EventArgs.Empty);
            }
            finally
            {
                InstrumentManager.InstExclusiveLockObject.ExitWriteLock();
            }

            return(insts.AsEnumerable());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="instrumentType"></param>
        public static void RemoveInstrument(InstrumentType instrumentType)
        {
            try
            {
                InstrumentManager.InstExclusiveLockObject.EnterWriteLock();

                var list = instruments[(int)instrumentType];
                list[list.Count - 1].Dispose();
                list.RemoveAt(list.Count - 1);
                InstrumentRemoved?.Invoke(typeof(InstrumentManager), EventArgs.Empty);
            }
            finally
            {
                InstrumentManager.InstExclusiveLockObject.ExitWriteLock();
            }
        }
Beispiel #3
0
 protected virtual void OnInstrumentRemoved(DataEventArgs args)
 {
     InstrumentRemoved.Raise(this, args);
 }