public void SetDataContext(VisualWaveForm visualWaveForm, bool isBinding)
        {
            VisualLinerSamples samples = new VisualLinerSamples();
            samples.TimeAxis = _internalTimeAxis;
            samples.YAxis = visualWaveForm.YAxis;
            samples.Samples = visualWaveForm.WaveSamples;
            _linerGraph.SetDataContext(samples);

            _internalTimeAxis.CopyPropertiesFrom(visualWaveForm.TimeAxis);
            _internalTimeAxis.SampleInterval = (double)1000 / visualWaveForm.Format.SamplesPerSecond;
            if (isBinding)
            {
                visualWaveForm.PropertyChanged += OnWaveFormPropertyChanged;
                _timeAxisPropertiesBinder = new ViewDataPropertyBinder(_internalTimeAxis, visualWaveForm.TimeAxis);
                _timeAxisPropertiesBinder.ExcludedProperties.Add("SampleInterval");
            }
        }
 public void SetDataContext(VisualWaveForm visualWaveForm)
 {
     SetDataContext(visualWaveForm, true);
 }
        /// <summary>
        /// Create a visual wave instance from the wave stream.
        /// </summary>
        /// <param name="waveStream">Stream.</param>
        /// <returns>VisualWaveForm.</returns>
        public static VisualWaveForm CreateFromStream(Stream waveStream)
        {
            VisualWaveForm waveForm = new VisualWaveForm();
            WaveFile waveFile = new WaveFile();
            waveFile.Load(waveStream);
            waveForm.Format = waveFile.Format;
            TransactionObservableCollection<double> samples = waveForm.WaveSamples;
            foreach (short sample in waveFile.DataIn16Bits)
            {
                samples.Add((double)sample);
            }

            waveForm.YAxis.Reset(samples, 0);
            return waveForm;
        }