private void SafeInvokeRecordingStopped()
        {
            if (RecordingStopped == null)
            {
                return;         //No Listeners
            }
            RecordingStoppedEvent listener = null;

            Delegate[] dels = RecordingStopped.GetInvocationList();

            foreach (Delegate del in dels)
            {
                try
                {
                    listener = (RecordingStoppedEvent)del;
                    listener.Invoke();
                }
                catch (Exception)
                {
                    //Could not reach the destination, so remove it
                    //from the list
                    RecordingStopped -= listener;
                }
            }
        }
Пример #2
0
        private void WaveSource_RecordingStopped(object sender, StoppedEventArgs e)
        {
            var bufArray = buffer.ToArray();

            if (bufArray.Length > 0)
            {
                RecordingStoppedEvent?.BeginInvoke(this, new SoundRecordingStoppedEventArgs(bufArray), null, null);
            }
            buffer.Clear();
        }