public static async Task Lesson(DataServiceRestClient client) { //The statistics in serviceInformation are calculated periodically by the server, and are not guaranteed to be always exact. var info = await client.GetServiceInformation(); Console.WriteLine(info.ServerName); }
/// <summary> /// This methods fetches the service information from both the data service and the raw data service. /// The service information contains general information about the services like its version and the /// servers feature set. Fetching the service information can also be used for connection check purposes /// since it's guaranteed that the check is fast and does not cause any noticeable server load. /// </summary> private async Task CheckConnection() { // Data Service try { //label18.Text = "PiWeb连接开始..."; //pictureBox5.Image = null; var sw = System.Diagnostics.Stopwatch.StartNew(); var serviceInformatrion = await _RestDataServiceClient.GetServiceInformation(); sw.Stop(); //pictureBox5.Image = Properties.Resources.选中; //label18.Text = "PiWeb连接成功"; connect2PiWebServer = true; } catch (Exception ex) { pictureBox1.Image = Properties.Resources.除; label2.Text = "PiWeb连接失败"; connect2PiWebServer = false; MessageBox.Show(ex.ToString()); } }