[英]Save a webpage in xaml/ C# to ApplicationData, universal app
I am learning C# and xaml, now when isolated storage isn't in windows universal, how can I save a page from the internet and compare it with a previously downloaded page and than view it in the webview? 我正在学习C#和xaml,现在当孤立存储不在Windows通用环境下时,如何保存来自互联网的页面并将其与以前下载的页面进行比较,然后在Webview中查看呢? Here is my attempt: C# code: 这是我的尝试:C#代码:
public sealed partial class OdpadloPage : Page
{
public OdpadloPage()
{
this.InitializeComponent();
DataContext = this;
ApplicationView.GetForCurrentView().
SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
}
My xaml code: 我的XAML程式码:
<Grid>
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<WebView Margin="10,0,10,10" Source="http://www.gyarab.cz/suplovani/suplov.htm"/>
</Grid>
As you mentioned , IsolatedStorageSettings is not supported at Windows Universal.Instead , you must use ApplicationDataContainer. 如前所述,Windows Universal不支持IsolatedStorageSettings,而必须使用ApplicationDataContainer。
What you have to do is simply call InvokeScriptAsync method of your webview and get the current source code of the page (you can use one-lined javascript code) and save it to the local settings by using ApplicationDataContainer. 您要做的就是简单地调用Webview的InvokeScriptAsync方法并获取页面的当前源代码(可以使用单行javascript代码),然后使用ApplicationDataContainer将其保存到本地设置。
Sorry that I'm not able to provide you some code examples atm. 抱歉,我无法为您提供一些atm代码示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.