public bool AddShipment(Shipment s) { ShipInfo shipInfo = TrackPackage(s); if (shipInfo == null) { return(false); } else { ShipInfoList.Add(shipInfo); return(true); } }
public ShipInfo TrackPackage(Shipment s) { HttpResponseMessage response = httpClient.GetAsync($"/v1/tracking?carrier_code={s.Courier}&tracking_number={s.TrackingNo}").Result; if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync(); string info = result.Result; try { ShipInfo shipInfo = JsonSerializer.Deserialize <ShipInfo>(info); shipInfo.SetCarrier(s.Courier); return(shipInfo); } catch (Exception e) { MessageBox.Show($"Error: {e.Message}"); } } return(null); }
public InfoWindow(ShipInfo info) { DataContext = info; InitializeComponent(); }