public MainWindow() { InitializeComponent(); mainThreadId_ = Thread.CurrentThread.ManagedThreadId; ecgGenerator_ = new DataGen.Electrocardiogram(); #if USE_RENDERING_CALLBACK CompositionTarget.Rendering += CompositionTarget_Rendering; #elif USE_DISPATCHERTIMER timer_ = new DispatcherTimer(); timer_.Tick += Timer__Tick; timer_.Interval = new TimeSpan(0, 0, 0, 0, 100); timer_.Start(); #elif USE_MMTIMER timer_ = new MMTimer(Timer__Tick) { Interval = 50, }; timer_.Start(); #elif USE_TIMERQUEUETIMER cancellationTokenSource_ = new CancellationTokenSource(); timer_ = new TimerQueueTimer(); waitOrTimerDelegate_ = new WaitOrTimerDelegate(Timer__Tick); // Avoid GC timer_.Create(1000, 50, waitOrTimerDelegate_); #endif stopwatch_ = Stopwatch.StartNew(); }
public ECGenerator(double hr, int fs) { generator_ = new DataGen.Electrocardiogram(hr); samplingRate_ = fs; }