mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-10-31 19:04:45 +00:00
0182641281
Added save state support to all machine components. Switched from xml serialization to binary serialization. Refactored audio service for performance. Bumped machine version to 0.9.0 for next release. Miscellaneous cosmetic or minor changes.
37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System;
|
|
using System.Windows.Threading;
|
|
|
|
namespace Jellyfish.Library
|
|
{
|
|
public static class DispatcherExtensions
|
|
{
|
|
public static void Post(this Dispatcher dispatcher, Action action)
|
|
{
|
|
if (dispatcher == null)
|
|
{
|
|
throw new ArgumentNullException("dispatcher");
|
|
}
|
|
if (action == null)
|
|
{
|
|
throw new ArgumentNullException("action");
|
|
}
|
|
|
|
new DispatcherSynchronizationContext(dispatcher).Post(state => action(), null);
|
|
}
|
|
|
|
public static void Send(this Dispatcher dispatcher, Action action)
|
|
{
|
|
if (dispatcher == null)
|
|
{
|
|
throw new ArgumentNullException("dispatcher");
|
|
}
|
|
if (action == null)
|
|
{
|
|
throw new ArgumentNullException("action");
|
|
}
|
|
|
|
new DispatcherSynchronizationContext(dispatcher).Send(state => action(), null);
|
|
}
|
|
}
|
|
}
|