2017-08-04 123 views
0

我在3個項目(PCL/Android/IOS)上安裝了插件 我使用的是Xamarin.forms和 調用彈出頁面的行在應用程序啓動:Rg.Plugin.PopupPage錯誤與呼叫線

未處理的異常:

System.InvalidOperationException:未創建平臺發生

[XamlCompilation(XamlCompilationOptions.Compile)] 
public partial class MenuView : ContentPage 
{ 
    List<Loja> lstLojas; 
    IGeolocator locator; 
    Loja lojaPerto; 
    Localizacao localizacao; 
    MyPopupPage s; 
    public MenuView() 
    { 
     s = new MyPopupPage(); 
     InitializeComponent(); 
     CallingGeolocatorAsync(); 
     login(); 
    } 

    void login() 
    { 
     Navigation.PushPopupAsync(s, true); 
    } 

這是我的彈出Page.cs

using System; 
using System.Threading.Tasks; 
using Rg.Plugins.Popup.Pages; 
using Rg.Plugins.Popup.Services; 
using Xamarin.Forms; 

namespace neoFly_Montana.PopUp 
{ 
public partial class MyPopupPage : PopupPage 
{ 
    public MyPopupPage() 
    { 
     InitializeComponent(); 
    } 

    private void OnClose(object sender, EventArgs e) 
    { 
     PopupNavigation.PopAsync(); 
    } 

    protected override Task OnAppearingAnimationEnd() 
    { 
     return Content.FadeTo(0.5); 
    } 

    protected override Task OnDisappearingAnimationBegin() 
    { 
     return Content.FadeTo(1); 
    } 
    } 
} 

這是我的彈出XML

<?xml version="1.0" encoding="utf-8" ?> 
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms" 
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
     xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" 
     xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup" 
     x:Class="neoFly_Montana.PopUp.MyPopupPage"> 
<!--Animations use example--> 
<pages:PopupPage.Animation> 
    <animations:ScaleAnimation 
    PositionIn="Center" 
    PositionOut="Center" 
    ScaleIn="1.2" 
    ScaleOut="0.8" 
    DurationIn="400" 
    DurationOut="300" 
    EasingIn="SinOut" 
    EasingOut="SinIn" 
    HasBackgroundAnimation="True"/> 
</pages:PopupPage.Animation> 
<!-- Content --> 

有人能幫忙嗎?

回答

0

你不能調用一個構造器......你需要使用:

protected override void OnAppearing() 
    { 
      base.OnAppearing(); 

      s = new MyPopupPage(); 
      PopupNavigation.PushAsync(s, true); 


    }