Files
Pixiview/Gallery/Login/HybridWebView.cs
2021-08-04 10:27:41 +08:00

40 lines
1.1 KiB
C#

using System;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace Gallery.Login
{
public class HybridWebView : WebView
{
public static readonly BindableProperty UriProperty = BindableProperty.Create(
nameof(Uri),
typeof(string),
typeof(HybridWebView));
public static readonly BindableProperty UserAgentProperty = BindableProperty.Create(
nameof(UserAgent),
typeof(string),
typeof(HybridWebView));
public event EventHandler LoginHandle;
public string Uri
{
get => (string)GetValue(UriProperty);
set => SetValue(UriProperty, value);
}
public string UserAgent
{
get => (string)GetValue(UserAgentProperty);
set => SetValue(UserAgentProperty, value);
}
public void OnLoginHandle()
{
if (LoginHandle != null)
{
MainThread.BeginInvokeOnMainThread(() => LoginHandle(this, EventArgs.Empty));
}
}
}
}