Forum Xamarin.Forms

Pass data using PopAsync

Hi ,

I'm Have to pass data after scan from camera using PopAsync .

    public async void Handle_OnScanResult(Result result)
        {

            Device.BeginInvokeOnMainThread(async () =>

            {
                                 //here I display the result as alert , but I want to PopAsync  to page1 which contain an entry for  result
                await DisplayAlert("Scanned result", result.Text, "OK");
                           });

                   }

I want to PopAsync to page1 which contain an entry for result .How can I do That ?

Posts

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    use MessagingCenter

  • Achraf_benalayaAchraf_benalaya USMember ✭✭

    @AlessandroCaliaro , I couldn't understand how this work ?

    scan page : MessagingCenter.Send<Resutpage, string>(??????, result.Text, result.Text);

    result page : MessagingCenter.Subscribe<string, string>("MyApp", "NotifyMsg", (sender, arg) => {
    TheVoucher.Text = arg;
    });

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    you can try with

    scan page : MessagingCenter.Send<App, string>((App)Xamarin.Forms.Application.Current, "NotifyMsg", result.Text);
    result page : MessagingCenter.Subscribe<App, string>((App)Xamarin.Forms.Application.Current, "NotifyMsg", (sender, arg) => {
    TheVoucher.Text = arg;
    });

Sign In or Register to comment.