Skip to content

Commit

Permalink
Merge pull request xamarin#16 from jsuarezruiz/gtk-label-render-issues
Browse files Browse the repository at this point in the history
LabelRenderer review
  • Loading branch information
jsuarezruiz authored Jun 28, 2017
2 parents 7e584c0 + 7895e84 commit 11f0596
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 11f0596

Please sign in to comment.