Browse Source

Update iOS and Android projects to use RenderTimers.

Jeremy Koritzinsky 7 years ago
parent
commit
3f5ec49b4a

+ 2 - 1
src/Android/Avalonia.Android/AndroidPlatform.cs

@@ -52,7 +52,8 @@ namespace Avalonia.Android
                 .Bind<ISystemDialogImpl>().ToTransient<SystemDialogImpl>()
                 .Bind<IWindowingPlatform>().ToConstant(Instance)
                 .Bind<IPlatformIconLoader>().ToSingleton<PlatformIconLoader>()
-                .Bind<IRenderLoop>().ToConstant(new DefaultRenderLoop(60))
+                .Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(60))
+                .Bind<IRenderLoop>().ToConstant(new RenderLoop())
                 .Bind<IAssetLoader>().ToConstant(new AssetLoader(app.GetType().Assembly));
 
             SkiaPlatform.Initialize();

+ 5 - 4
src/iOS/Avalonia.iOS/DisplayLinkRenderLoop.cs → src/iOS/Avalonia.iOS/DisplayLinkRenderTimer.cs

@@ -5,11 +5,12 @@ using Foundation;
 
 namespace Avalonia.iOS
 {
-    class DisplayLinkRenderLoop : IRenderLoop
+    class DisplayLinkRenderTimer : IRenderTimer
     {
-        public event EventHandler<EventArgs> Tick;
+        public event Action<long> Tick;
         private CADisplayLink _link;
-        public DisplayLinkRenderLoop()
+
+        public DisplayLinkRenderTimer()
         {
 
             _link = CADisplayLink.Create(OnFrame);
@@ -20,7 +21,7 @@ namespace Avalonia.iOS
         {
             try
             {
-                Tick?.Invoke(this, new EventArgs());
+                Tick?.Invoke(Environment.TickCount);
             }
             catch (Exception)
             {

+ 2 - 1
src/iOS/Avalonia.iOS/iOSPlatform.cs

@@ -41,7 +41,8 @@ namespace Avalonia.iOS
                 .Bind<IPlatformThreadingInterface>().ToConstant(PlatformThreadingInterface.Instance)
                 .Bind<IPlatformIconLoader>().ToSingleton<PlatformIconLoader>()
                 .Bind<IWindowingPlatform>().ToSingleton<WindowingPlatformImpl>()
-                .Bind<IRenderLoop>().ToSingleton<DisplayLinkRenderLoop>();
+                .Bind<IRenderTimer>().ToSingleton<DisplayLinkRenderTimer>()
+                .Bind<IRenderLoop>().ToSingleton<RenderLoop>();
         }
     }
 }