我想为我的 Web 应用程序制作一个容器应用程序,我决定在 Xamarin 中这样做,因为项目的其余部分也是 .NET。
最初我从 Xamarin 示例页面下载并设置了项目:https ://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs = windows
我只是在 WebPage.cs 中更改了一些变量:https : //github.com/xamarin/xamarin-forms-samples/blob/master/WorkingWithWebview/WorkingWithWebview/WebPage.cs
using Xamarin.Forms;
namespace WorkingWithWebview
{
public class WebPage : ContentPage
{
public WebPage()
{
var browser = new WebView();
browser.Source = "https://xamarin.swappsdev.net";
Content = browser;
}
}
}
Run Code Online (Sandbox Code Playgroud)
其次,我更新了 App.cs 以满足我的需求:https : //github.com/xamarin/xamarin-forms-samples/blob/master/WorkingWithWebview/WorkingWithWebview/App。
using Xamarin.Forms;
namespace WorkingWithWebview
{
public class App : Application
{
public App ()
{
MainPage = new WebPage();
}
}
}
Run Code Online (Sandbox Code Playgroud)
和繁荣!我有一个应用程序。
然后才是真正的挣扎。在 Web 应用程序中,我可以 …