- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的WP7应用程序中有一个ErrorPage.xaml页面。发生未处理的异常时,将调用app.xaml.cs中的方法,并将该异常传递给ErrorPage.xaml.cs,并通过链接返回到用户的方式向用户显示错误。
如果我单击AppBar IconButton的速度过快,则会引发“导航失败”事件,仍然会调用错误页面,但错误页面上不会显示任何内容。 AppBar是唯一可见的东西。
不知道为什么
这是我的app.xaml.cs中的代码
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
e.Handled = true;
ErrorPage.Exception = e.ExceptionObject;
(RootVisual as Microsoft.Phone.Controls.PhoneApplicationFrame).Source =
new Uri(Navigation.PAGE_ERROR, UriKind.Relative);
}
<Grid x:Name="LayoutRoot" Background="{StaticResource GlobalPageBackgroundBrush}" CacheMode="BitmapCache">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="24,24,0,12">
<TextBlock x:Name="ApplicationTitle" Text="{StaticResource AppName}" Style="{StaticResource PhoneTextNormalStyle}" FontWeight="SemiBold"/>
<TextBlock x:Name="PageTitle" Text="error" Margin="-3,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1">
<TextBlock x:Name="ErrorText" Style="{StaticResource PhoneTextTitle3Style}" TextWrapping="Wrap" />
<StackPanel x:Name="FriendlyErrorStackPanel" Margin="0,100,0,0" Orientation="Vertical">
<TextBlock Style="{StaticResource PhoneTextTitle3Style}" TextWrapping="Wrap">
<TextBlock.Text>
Please click the link below to return to the main page of the application.
</TextBlock.Text>
</TextBlock>
<HyperlinkButton Style="{StaticResource PhoneHyperlinkStyle}" Content="Start Over" NavigateUri="/Views/MainPage.xaml" />
</StackPanel>
</Grid>
</Grid>
public partial class ErrorPage : PhoneApplicationPage
{
public ErrorPage()
{
InitializeComponent();
}
public static Exception Exception;
// Executes when the user navigates to this page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (Exception != null)
{
if (System.Diagnostics.Debugger.IsAttached)
{
FriendlyErrorStackPanel.Visibility = System.Windows.Visibility.Collapsed;
ErrorText.Text = Exception.ToString();
}
else
{
FriendlyErrorStackPanel.Visibility = System.Windows.Visibility.Visible;
ErrorText.Text = GlobalConstants.DEFAULT_ERROR_MESSAGE;
}
}
base.OnNavigatedTo(e);
}
}
最佳答案
我怀疑一旦击中Application_UnhandledException并将Exception设置为Handled = true,则如果快速连续获得两次,它可能会变得片状-解决方法是确保AppBar Button在尝试执行操作时仅允许按一下某些东西(因此在尝试导航时将其禁用,如果失败则重新启用)
另外,请考虑对您的Navigate方法调用使用Dispatcher.BeginInvoke()(如果尚未这样做)。
关于error-handling - wp7错误处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4372037/
我正在尝试在我正在处理的博客上使用类别帖子 (WP-CPL) 插件来按类别过滤“最近的帖子”。基本上,当有人点击博客上的类别名称时,我希望它显示该类别的帖子。这将通过 Life Is Simple 模
我的形象 我只想为某些用户隐藏特定页面。 function remove_menus(){ // get current login user's role $roles = wp_g
我的形象 我只想为某些用户隐藏特定页面。 function remove_menus(){ // get current login user's role $roles = wp_g
我为我的 wp 网站创建了一个简单的脚本,我正在尝试从 2 个表的 wp 数据库中获取正确的数据,这是代码, 当我显示“user_ref_id”列的结果重复多次时,这是代码 global $wpdb;
我安装了一个名为 Hide My WP 的插件来更改网站结构,但考虑到我使用的是自定义主题,它破坏了一些功能。所以我手动从plugins文件夹中删除了插件,但是从那以后我就无法访问/wp-admin/
我试图从头开始创建 WXR 文件(WordPress eXtended Rss)。 我的代码基于 XML/ wordpress生成的WXR文件并像这样开始: 我是这样开始的: $newxml =
我想将所有页面重定向到 http://www.expample2.com除了 wp-admin 和 wp-json。 例如,用户能够登录 http://www.example1.com/wp-admi
我使用 MAMP 在本地构建了一个快速的 WordPress 网站,然后将其 checkin SVN 存储库。然后我将其检查到我的开发服务器上。 除了运行 search and replace too
在搜索端点的 WP REST API (wp json) 中: https://www.example.com/wp-json/wp/v2/search?search=searchPhrase&_em
我正在使用这个 NGINX 规则来强制 WordPress 网站的尾部斜杠: rewrite ^([^.]*[^/])$ $1/ permanent; 但是这个规则给 Gutenberg 和 wp-j
在搜索端点的 WP REST API (wp json) 中: https://www.example.com/wp-json/wp/v2/search?search=searchPhrase&_em
我正在使用这个 NGINX 规则来强制 WordPress 网站的尾部斜杠: rewrite ^([^.]*[^/])$ $1/ permanent; 但是这个规则给 Gutenberg 和 wp-j
我想限制所有用户访问 WordPress 网站登录。 例如:假设我有 WordPress 网站域 example1.com,我想限制所有用户使用 example1.com/wp- 访问管理员登录adm
尝试实现这里讨论的技术, http://z9.io/2013/10/21/shiny-new-dynamic-content-wp-super-cache/ 进入使用 Genesis 框架的站点。我想
我试图在位于我的 WP 主题文件夹内的 PHP 文件中调用自定义 AJAX 函数,但是我无法让它检索输出。我认为问题在于将 WP 查询链接到主 WP 文件? $.ajax({ url: "../../
我正在编写一个 perl 脚本,用于将 Wordpress 安装从一个地方迁移到另一个地方。在这项工作中,我需要使用 wp-cli 调用从 wp-config 文件中获取 wordpress 数据库名
我最近更改了我的 WordPress 网站上的目录。我导出了数据库,搜索并替换了旧 URL 为新 URL,然后重新导入。该网站的前端工作正常,但任何页面的后端都需要近 15 秒才能加载。 从funct
我使用下面的代码通过类似的单词标签获取帖子但不起作用 $query = " SELECT * FROM $wpdb->posts , $wpdb->terms
我已经通过 DirectAdmin 在我的服务器上安装了 SSL 证书。这似乎运作良好。 我已将 wp_*_options 表中的 url 更改为 https://mydomain.nl 等。突然我的
我正在建立一个网站,使用 wordpress+buddypress(最新版本)。 在这个网站中,我有自己的自定义登录|注册|重置密码表单,我不想将它们链接到后端 wp-forms。 我已经阻止了所有用
我是一名优秀的程序员,十分优秀!