private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { if (loaded) { return; } string timestamp = TimeChange.ToUnix(DateTime.Now); //string longtime = TimeChange.ToLongUnix(DateTime.Now); HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, new Uri(url)); FormUrlEncodedContent postData = new FormUrlEncodedContent( new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("timestamp", timestamp), new KeyValuePair <string, string>("u", ""), new KeyValuePair <string, string>("noncestr", "ND7DBOM651JA4ODXLDPI37ASZKCBC32I"), new KeyValuePair <string, string>("mc", "0000000005e6b1d8ffffffff9c1fe4e0"), new KeyValuePair <string, string>("appuid", ""), new KeyValuePair <string, string>("hardName", DeviceFlag.GetDeviceFlag()), new KeyValuePair <string, string>("ac", "d5424fa6-adff-4b0a-8917-4264daf4a348"), new KeyValuePair <string, string>("bv", "2014"), new KeyValuePair <string, string>("vc", "3.5"), new KeyValuePair <string, string>("vs", "4.4.4"), new KeyValuePair <string, string>("appsign", "12c56931c985342d94058da7e5772b4b") } ); request.Content = postData; HttpResponseMessage response = await client.SendAsync(request); string responseString = await response.Content.ReadAsStringAsync(); va = JsonConvert.DeserializeObject <vaccine>(responseString); if (va.Success) { va.Data.ForEach(z => { vList.Add(z); }); Group <vaccineSec> .GetItemGroups(vList, i => i.Months).ForEach(p => group.Add(p)); } else { MessageHelper.Show("获取数据失败"); } }
/// <summary> /// Gets device information. /// </summary> /// <returns></returns> public DeviceInstance[] ListDevices(DeviceClass deviceType = DeviceClass.All, DeviceFlag flags = DeviceFlag.AttachedOnly) { DeviceInstance[] array = new DeviceInstance[50]; int l = array.Length; int result = DI_EnumDevices(Handle, (uint)deviceType, (uint)flags, array, ref l); if (result >= 0) { if (l != array.Length) { Array.Resize(ref array, l); } return(array); } throw new Exception("Error code " + result.ToString()); }