Ooui-tws-port/Ooui.Forms/PlatformRenderer.cs

34 lines
890 B
C#
Raw Normal View History

2017-11-09 09:38:19 +00:00
using System;
using Xamarin.Forms;
namespace Ooui.Forms
{
public class PlatformRenderer : Ooui.Div
{
readonly Platform platform;
public Platform Platform => platform;
public override bool WantsFullScreen => true;
2017-11-09 09:38:19 +00:00
public PlatformRenderer (Platform platform)
{
this.platform = platform;
}
2017-12-11 03:02:41 +00:00
protected override bool TriggerEventFromMessage (Message message)
{
if (message.TargetId == "window" && message.Key == "resize" && message.Value is Newtonsoft.Json.Linq.JObject j) {
var width = (double)j["width"];
var height = (double)j["height"];
Platform.Element.Style.Width = width;
Platform.Element.Style.Height = height;
return true;
}
else {
return base.TriggerEventFromMessage (message);
}
}
2017-11-09 09:38:19 +00:00
}
}