public void PlaySound(Tone tone, TimeSpan duration)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (_timer == null)
                {
                    _timer = new DispatcherTimer
                    {
                        Interval = TimeSpan.FromMilliseconds(33)
                    };
                    _timer.Tick += delegate { try { FrameworkDispatcher.Update(); } catch { } };
                }

                if (_timer.IsEnabled) _timer.Stop();

                _timeLeft = duration;

                FrameworkDispatcher.Update();
                _frequency = tone;
                _dynamicSound = new DynamicSoundEffectInstance(SampleRate, AudioChannels.Mono);
                _dynamicSound.BufferNeeded += dynamicSound_BufferNeeded;
                _dynamicSound.Play();
                _bufferSize = _dynamicSound.GetSampleSizeInBytes(TimeSpan.FromSeconds(1));
                _soundBuffer = new byte[_bufferSize];

                _timer.Start();
            });
        }
 public void Notify(Tone tone)
 {
     PlayTones(0, tone);
 }
 public void Notify(Tone tone)
 {
     PlayTones(0, tone);
 }