private async void Btn_presentTravel_Click(object sender, EventArgs e) { string url = "https://localhost:5001/api/Travel/get?uid=" + Uid; XmlSerializer xmlSerializer = new XmlSerializer(typeof(List <Travel>)); Client client = new Client(); try { HttpResponseMessage result = await client.Get(url); if (result.IsSuccessStatusCode) { List <Travel> travels = (List <Travel>)xmlSerializer.Deserialize(await result.Content.ReadAsStreamAsync()); Travel presentTravel = travels.First(); UC_AllSites uc_allsite = new UC_AllSites(changePanel, presentTravel.Description, presentTravel.TravelId); AddControlsToPanel(uc_allsite); } } catch (Exception ex) { MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void Btn_presentTravel_Click(object sender, EventArgs e) { UC_AllSites uc_allsite = new UC_AllSites(changePanel); AddControlsToPanel(uc_allsite); }