Skip to content

Commit

Permalink
Many labels were not rendering, some changes for performance test bro…
Browse files Browse the repository at this point in the history
…ke them. Changes on StartTimer using GLib Timeout seems to work.
  • Loading branch information
sescalada committed Jun 28, 2017
1 parent 7e584c0 commit 7895e84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
14 changes: 3 additions & 11 deletions Xamarin.Forms.Platform.GTK/GtkPlatformServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,11 @@ public void OpenUriAction(Uri uri)

public void StartTimer(TimeSpan interval, Func<bool> callback)
{
var timer = new System.Timers.Timer(interval.TotalMilliseconds);

timer.Elapsed += (sender, args) =>
GLib.Timeout.Add((uint)interval.TotalMilliseconds, () =>
{
var result = callback();

if (!result)
{
timer.Stop();
}
};

timer.Start();
return result;
});
}

private static int Hex(int v)
Expand Down
10 changes: 2 additions & 8 deletions Xamarin.Forms.Platform.GTK/Renderers/LabelRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ private void UpdateText()

if (formatted != null)
{
Gtk.Application.Invoke(delegate
{
Control.SetTextFromFormatted(formatted);
});
Control.SetTextFromFormatted(formatted);
}
else
{
Expand All @@ -87,10 +84,7 @@ private void UpdateText()
Text = Element.Text
};

Gtk.Application.Invoke(delegate
{
Control.SetTextFromSpan(span);
});
Control.SetTextFromSpan(span);
}
}

Expand Down

0 comments on commit 7895e84

Please sign in to comment.