My Solution:
* ViewModels
* * DownloadPageViewModel.cs
* * LoginPageViewModel.cs
* Views
* * DownloadPage.xaml
* * LoginPage.xaml
* App.xaml
I have:
a entry and button in DownloadPage.xaml
a webview in LoginPage.xaml
LoginPageViewModel.cs:
public string posturl; public string InnerBody public DelegateCommand<WebView> WebViewOnNavigatedCommand { get; } public LoginPageViewModel() { WebViewOnNavigatedCommand = new DelegateCommand<WebView>(async webView => { InnerBody = await webView.EvaluateJavaScriptAsync("document.body.innerHTML"); InnerBody = Regex.Unescape(InnerBody); });
}
namespace MyApp.ViewModels
{
public class DownloadPageViewModel : BindableBase
{
private string _postUrl; public string PostUrl { get => _postUrl; set { if (Connectivity.NetworkAccess == NetworkAccess.None) { Status = "Status: No internet connection"; return; } SetProperty(ref _postUrl, value); DownloadCommand.RaiseCanExecuteChanged(); } }
I want to call
posturl from DownloadPageViewModel.cs for LoginPage webview.
InnerBody from LoginPageViewModel.cs for DownloadPageViewModel.cs
Sorry, I'm very new in this language. I've been dealing with this for a few hours but I didn't.