我在弹出窗口中填充了一个列表视图。 我正在使用
的1.0.4版本<?php
header("Content-Type: application/json; charset=UTF-8");
include_once("../app/modules_bl/emailBL.class.php");
$email = isset($_POST["email"]) ? $_POST["email"] : "";
$EmailBL = new EmailBL();
$ObjectsFromBM = $EmailBL->GetEmail();
foreach ($ObjectsFromBM as $ObjectFromBM)
{
$arrayofEmails[]= $ObjectFromBM->GetEMAIL_BM();
}
$returnedMsg = ServerValidationMessage($email);
$validatedEmail = array("validationMessage" => "$returnedMsg");
print(json_encode($validatedEmail));
function ServerValidationMessage($email)
{
if(is_array($email) || is_numeric($email) || is_bool($email) || is_float($email) || is_file($email) || is_dir($email) || is_int($email))
{
return $emailfalseMsg;
}
else
{
$email= trim(strtolower($email));
$emailtrueMsg = "Uspešno ste uneli email i prijavili se na naš newslettter!";
$emailfalseMsg = "Morate uneti ispravnu email adresu!";
$emptyemailfieldMsg = "Unesite email!";
$emailduplicatedMsg = "Vi ste se već prijavili na naš newletter sa ovom email adresom!";
if(filter_var($email, FILTER_VALIDATE_EMAIL) !== false && $email != "")
{
$EmailBL = new EmailBL();
$ObjectsFromBM = $EmailBL->GetEmail();
foreach ($ObjectsFromBM as $ObjectFromBM)
{
$arrayofEmails[]= $ObjectFromBM->GetEMAIL_BM();
}
if(in_array($email, $arrayofEmails) && isset($arrayofEmails))
{
return $emailduplicatedMsg;
}
else
{
$EmailBL->InsertEmail();
return $emailtrueMsg;
}
}
if(filter_var($email, FILTER_VALIDATE_EMAIL) === false && $email != "")
{
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
return (preg_match($pattern, $email) === 1) ? $emailtrueMsg : $emailfalseMsg;
}
if($email == "")
{
return $emptyemailfieldMsg;
}
}
}
在选择列表项时,我正在打电话
Rg.plugins.popup.
关闭弹出窗口。
但是有时候我会崩溃:
PopupNavigation.PopAsync(true);
我认为崩溃是因为我的某些用户双击了列表项。 在调用
之前,我是否需要始终检查弹出堆栈计数吗?Android.Runtime.JavaProxyThrowable: Exception of type 'Android.Runtime.JavaProxyThrowable' was thrown. --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.IndexOutOfRangeException: There is not page in PopupStack at Rg.Plugins.Popup.Services.PopupNavigation.PopAsync (System.Boolean animate) [0x0000c] in :0 at TCRMobile.ViewModels.TicketsListGenericViewModel.OpenTicketTabsPage (TCRMobile.DataObjects.Ticket selectedTicket, System.Int32 mobileID, System.Nullable`1[T] laborMiscTimeMobileID) [0x00000] in :0 at TCRMobile.ViewModels.TicketsListGenericViewModel+<>c__DisplayClass13_0.b__0 () [0x00055] in :0 at TCRMobile.Droid.Services.DialogService+<>c__DisplayClass5_0.b__1 (System.Object sender, Android.Content.DialogClickEventArgs e) [0x0001d] in <5c6ae91b284846f5995b4e735df62b69>:0 at Android.Content.IDialogInterfaceOnClickListenerImplementor.OnClick (Android.Content.IDialogInterface dialog, System.Int32 which) [0x00012] in <1ccf2ea9504d42c08b47c05ee0c5e9f7>:0 at Android.Content.IDialogInterfaceOnClickListenerInvoker.n_OnClick_Landroid_content_DialogInterface_I (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_dialog, System.Int32 which) [0x0000f] in <1ccf2ea9504d42c08b47c05ee0c5e9f7>:0 at (wrapper dynamic-method) System.Object:d515a9d0-d793-4191-a5c6-5e450c1fd743 (intptr,intptr,intptr,int) at mono.android.content.DialogInterface_OnClickListenerImplementor.n_onClick(Native Method) at mono.android.content.DialogInterface_OnClickListenerImplementor.onClick(DialogInterface_OnClickListenerImplementor.java:30) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:175) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1534) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1424)
如果更新上述弹出库可以解决此问题?
请说明崩溃的原因和解决方法。
谢谢
答案 0 :(得分:1)
尝试此弹出式ViewPage。
<?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"
x:Class="RootNamespace.Views.NeedHelpPopupView"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:Controls="clr-namespace:RootNamespace.Controls">
<pages:PopupPage.Animation>
<animations:ScaleAnimation DurationIn="400" DurationOut="300" EasingIn="SinOut" EasingOut="SinIn" HasBackgroundAnimation="True" PositionIn="Center" PositionOut="Center" ScaleIn="1.2" ScaleOut="0.8" />
</pages:PopupPage.Animation>
<StackLayout Padding="20,20,20,20" HorizontalOptions="Center" VerticalOptions="Center">
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Frame CornerRadius="10" Grid.Row="0" BackgroundColor="{StaticResource YetiBlue}" HasShadow="False" Margin="20,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Image Source="{Binding IconNeedHelp}"/>
<Image Source="{Binding IconClose}" x:Name="ImageClose" HorizontalOptions="End" VerticalOptions="Start"/>
</Grid>
</Grid>
</Frame>
<Frame CornerRadius="10" Grid.Row="0" BackgroundColor="{StaticResource YetiBlue}" HasShadow="False" Margin="10,130,10,0">
</Frame>
<Frame CornerRadius="10" Grid.Row="0" BackgroundColor="{StaticResource White}" Margin="10,120,10,10" HasShadow="False">
<Grid BackgroundColor="{StaticResource White}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Controls:Label Grid.Row="0" Text="{Binding LabelNeedHelpTitle}" TextColor="{Binding Black}" HorizontalOptions="Center" FontAttributes="Bold" FontSize="20"/>
<BoxView Grid.Row="1" VerticalOptions="CenterAndExpand" HorizontalOptions="Center" WidthRequest="80" HeightRequest="4" Color="{StaticResource YetiBlue}"/>
<Controls:Label Grid.Row="2" Text="{Binding LabelDescription}" TextColor="{Binding Black}" HorizontalOptions="CenterAndExpand" FontAttributes="Bold" FontSize="17" Margin="{StaticResource Margin10}"/>
</Grid>
</Frame>
</Grid>
</StackLayout>
</pages:PopupPage>
这是导航部分。
protected override void OnAppearing()
{
base.OnAppearing();
ImageClose.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(_ =>
{
PopupNavigation.Instance.PopAsync();
})
});
}
Android
在MainActivity.cs文件中。
Rg.Plugins.Popup.Popup.Init(this, bundle);
IOS
在AppDelegate.cs文件中。
Rg.Plugins.Popup.Popup.Init();
尝试使用此代码。
并且在项目 Rg.Plugins.Popup 1.1.4.158-pre 软件包中已安装。
答案 1 :(得分:0)
可能这不是明智的选择。
称呼
await PopUpService.PopUpAll();
服务
public static class PopUpService
{
public static async Task PopUpAll()
{
if (Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack.Any())
{
await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAllAsync();
}
}
}