2

webview.navigate(url) を使用すると、アプリ全体がフリーズします。x86 チップでは顕著ですが、タブレットは 50 秒近く完全にフリーズします。

スレッドをマーシャリングするために多くのことを試しましたが、それを改善するものは何もありません。

何かアドバイス?

ここにxamlとc#があります

<Page
    x:Class="WebviewSample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WebviewSample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0">
            <ListView x:Name="listView" ItemsSource="{Binding}" SelectionChanged="ListView_OnSelectionChanged">

            </ListView>
        </Grid>
        <Grid Grid.Column="1">
            <WebView x:Name="webView"></WebView>
        </Grid>
    </Grid>
</Page>



using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace WebviewSample
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var itemsList = new List<ListViewItem>();
            for (var i = 0; i < 300; i++)
            {
                var listViewItem = new ListViewItem {Content = "Click Me!"};
                itemsList.Add(listViewItem);
            }
            listView.DataContext = itemsList;
        }

        private void ListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            webView.Navigate(new Uri("http://online.wsj.com/article/SB10001424127887324299104578529112289298922"));
        }
    }
}
4

0 に答える 0