[C#] [XAML]更改资源文件运行时? [英] [C#][XAML]Change a Resource File Runtime ?

查看:115
本文介绍了[C#] [XAML]更改资源文件运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用C#和XAML的UAP。

I have a UAP using C# and XAML.

我在我的解决方案中加入了一个加载的Html页面js脚本。为了正确显示页面,我必须使用带有NavigateToLocalStreamUri的webview。此方法有效,但前提是您的解决方案中嵌入了Html文件。我有
使它工作,但问题是Html每次都不一样。 js是。

I have included in my solution an Html page which loads js scripts . In order to display correctly the page I have to use the webview with the NavigateToLocalStreamUri . This method works but only if you have the Html file embedded in your solution. I have make it work but the thing is that the Html is not the same each time. The js are.

如果我想显示相关的js我必须1.每次在文件夹中写入或2.将它们写入HTML。

If I want to display correclty the js I had to 1. write them each time in a folder or 2. write them inside the html .

有没有办法改变这个emebedded资源,我该怎么做?

Is there any way to change this emebedded resource and how do I do that ?

否则

如何加载JS并在webview中显示它的全部功能?

how can I load the JS and display it in the webview with its full functionality ?

感谢您的帮助。

谢谢

推荐答案

嗨zakkar,

Hi zakkar,

>>"我有一个使用C#和XAML的UAP。"

如果我没有误解你,那就是一个UWP应用程序。

>>"I have a UAP using C# and XAML."
If I do not misunderstand you, it's a UWP app.

>>''如何加载JS并在webview中显示它的全部功能?"

您可以使用InvokeScriptAsync,例如:

>>''how can I load the JS and display it in the webview with its full functionality ?"
You could use InvokeScriptAsync, for example:

await this.webview1.InvokeScriptAsync("eval",  new string[] {"document.body.style.backgroundColor = 'black'"});

最好的问候,

guang9Bear

guang9Bear


这篇关于[C#] [XAML]更改资源文件运行时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆