Browse Source

Fixed bug in scheduler and runtime platform.

Jeremy Koritzinsky 9 years ago
parent
commit
428466ced3

+ 1 - 7
src/Avalonia.Base/Threading/AvaloniaScheduler.cs

@@ -26,13 +26,7 @@ namespace Avalonia.Threading
         /// <inheritdoc/>
         public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
         {
-            return DispatcherTimer.Run(
-                () =>
-                {
-                    action(this, state);
-                    return false;
-                },
-                dueTime);
+            return DispatcherTimer.RunOnce(() => action(this, state), dueTime);
         }
     }
 }

+ 1 - 4
src/Shared/PlatformSupport/StandardRuntimePlatform.cs

@@ -16,10 +16,7 @@ namespace Avalonia.Shared.PlatformSupport
         public void PostThreadPoolItem(Action cb) => ThreadPool.UnsafeQueueUserWorkItem(_ => cb(), null);
         public IDisposable StartSystemTimer(TimeSpan interval, Action tick)
         {
-            var timer = new Timer(delegate
-            {
-
-            }, null, interval, interval);
+            var timer = new Timer(_ => tick(), null, interval, interval);
             return Disposable.Create(() => timer.Dispose());
         }