You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
961 B
41 lines
961 B
using System;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Demo.Infrastructure
|
|
{
|
|
public class HybridWebView : View
|
|
{
|
|
private Action<string> action;
|
|
|
|
public static readonly BindableProperty UriProperty = BindableProperty.Create(
|
|
propertyName: "Uri",
|
|
returnType: typeof(string),
|
|
declaringType: typeof(HybridWebView),
|
|
defaultValue: default(string));
|
|
|
|
public string Uri
|
|
{
|
|
get { return (string)GetValue(UriProperty); }
|
|
set { SetValue(UriProperty, value); }
|
|
}
|
|
|
|
public void RegisterAction(Action<string> callback)
|
|
{
|
|
action = callback;
|
|
}
|
|
|
|
public void Cleanup()
|
|
{
|
|
action = null;
|
|
}
|
|
|
|
public void InvokeAction(string data)
|
|
{
|
|
if (action == null || data == null)
|
|
{
|
|
return;
|
|
}
|
|
action.Invoke(data);
|
|
}
|
|
}
|
|
} |