-
-
Save EgorBo/0659e8e1b42ea72190b7 to your computer and use it in GitHub Desktop.
dispatcher performance
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
private Stopwatch _stopwatch = new Stopwatch(); | |
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) | |
{ | |
ThreadPool.QueueUserWorkItem(_ => | |
{ | |
_stopwatch.Start(); | |
Dispatcher.Invoke(() => | |
{ | |
_stopwatch.Stop(); | |
MessageBox.Show("elapsed: " + _stopwatch.ElapsedTicks); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment