2
LoginPage.xaml.csにはwebview wviewがあります。 Navigatedイベントが発生したときに私のViewModelでコマンドを実行したい。私のコマンドは私のwebviewからURLを受け取るべきです。ReactUIの文字列をXamarinフォームで受信するReactiveCommandの作成方法
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);
}
は、どのように私はこれに反応できるコマンドを作成するのですか?
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();
});
}
を[ここでは良いチュートリアルです] ReactiveUIとXamarin Formsのコマンドをカバーするようになっています(http://fullstackmark.com/post/5/a-simple-vocabulary-app-using-reactiveu-and-xamarin-forms)。 – mmacneil007
大きなヒント! thx @ mmacneil007 – jtourlamain