If the method which includes "await wc.DownloadStringTaskAsync (url)", then the method name can not be Chinese, otherwis
Posted: Wed Dec 07, 2016 4:32 pm
Dear JS-Support,
If the method which includes "await wc.DownloadStringTaskAsync (url)", then the method name can not be Chinese, otherwise ...
The following code works fine in the emulator and the browser:
The above code works as shown below
Then we make the following changes to the code, "get()" to "获取()" (that is, the method name to Chinese):
Modified, it can work in the simulator, and in the browser, the following tips will not work:
Best Regards,
Tomny
If the method which includes "await wc.DownloadStringTaskAsync (url)", then the method name can not be Chinese, otherwise ...
The following code works fine in the emulator and the browser:
Code: Select all
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.Net;
namespace GetTest1
{
public partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
get();
}
public async void get()
{
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
string url = "http://localhost:30095/GetMoBanList.aspx";
string mbStr = await wc.DownloadStringTaskAsync(url);
System.Windows.MessageBox.Show(mbStr);
}
}
}
The above code works as shown below
Then we make the following changes to the code, "get()" to "获取()" (that is, the method name to Chinese):
Code: Select all
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.Net;
namespace GetTest1
{
public partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
获取();
}
public async void 获取()
{
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
string url = "http://localhost:30095/GetMoBanList.aspx";
string mbStr = await wc.DownloadStringTaskAsync(url);
System.Windows.MessageBox.Show(mbStr);
}
}
}
Modified, it can work in the simulator, and in the browser, the following tips will not work:
Best Regards,
Tomny