Created
March 14, 2013 15:05
-
-
Save BartDM/5162073 to your computer and use it in GitHub Desktop.
Code samples of blog post Creating graphs in WPF using OxyPlot on http://blog.bartdemeyer.be
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MainWindow() | |
{ | |
viewModel = new ViewModels.MainWindowModel(); | |
DataContext = viewModel; | |
CompositionTarget.Rendering += CompositionTargetRendering; | |
stopwatch.Start(); | |
InitializeComponent(); | |
} | |
private long frameCounter; | |
private System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); | |
private long lastUpdateMilliSeconds; | |
private void CompositionTargetRendering(object sender, EventArgs e) | |
{ | |
if (stopwatch.ElapsedMilliseconds > lastUpdateMilliSeconds + 5000) | |
{ | |
viewModel.UpdateModel(); | |
Plot1.RefreshPlot(true); | |
lastUpdateMilliSeconds = stopwatch.ElapsedMilliseconds; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment