In my LoginPage.xaml.cs I have a webview wview. I want to execute a command in my ViewModel when the Navigated event is triggered om my wview. My command should receive the url from my webview.
LoginPage.xaml.cs:
protected override void OnAppearing()
{
base.OnAppearing();
Observable.FromEventPattern<WebNavigatedEventArgs>(
ev => wview.Navigated += ev,
ev => wview.Navigated -= ev)
.Select(x => x.EventArgs.Source.ToString())
.InvokeCommand(ViewModel.VerifyCallbackUrl);
}
How do I create a command that can react on this? The following code doesn't compile (Delegate action does not take 1 argument) :
public ReactiveCommand<string,System.Reactive.Unit> VerifyCallbackUrl { get; protected set; }
public LoginViewModel(IScreen hostScreen = null) : base(hostScreen)
{
VerifyCallbackUrl = ReactiveCommand<string, System.Reactive.Unit>
.Create(xUrl =>
{
DoSomethingUseful();
});
}