public async void Refresh() { base.Refresh(); Refreshing = true; Vehicles.Clear(); var vehicles = await Services.Host.VehicleService.GetVehicles(); if (vehicles.Any()) { foreach (var v in vehicles) { var vehicleViewModel = new VehicleViewModel(v); Vehicles.Add(vehicleViewModel); } } else { NoVehicles?.Invoke(this, EventArgs.Empty); } Refreshing = false; }
/// <summary> /// Returns true if Solution instances are equal /// </summary> /// <param name="input">Instance of Solution to be compared</param> /// <returns>Boolean</returns> public bool Equals(Solution input) { if (input == null) { return(false); } return (( Costs == input.Costs || (Costs != null && Costs.Equals(input.Costs)) ) && ( Distance == input.Distance || (Distance != null && Distance.Equals(input.Distance)) ) && ( Time == input.Time || (Time != null && Time.Equals(input.Time)) ) && ( TransportTime == input.TransportTime || (TransportTime != null && TransportTime.Equals(input.TransportTime)) ) && ( MaxOperationTime == input.MaxOperationTime || (MaxOperationTime != null && MaxOperationTime.Equals(input.MaxOperationTime)) ) && ( WaitingTime == input.WaitingTime || (WaitingTime != null && WaitingTime.Equals(input.WaitingTime)) ) && ( NoVehicles == input.NoVehicles || (NoVehicles != null && NoVehicles.Equals(input.NoVehicles)) ) && ( NoUnassigned == input.NoUnassigned || (NoUnassigned != null && NoUnassigned.Equals(input.NoUnassigned)) ) && ( Routes == input.Routes || Routes != null && Routes.SequenceEqual(input.Routes) ) && ( Unassigned == input.Unassigned || (Unassigned != null && Unassigned.Equals(input.Unassigned)) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Costs != null) { hashCode = hashCode * 59 + Costs.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (Time != null) { hashCode = hashCode * 59 + Time.GetHashCode(); } if (TransportTime != null) { hashCode = hashCode * 59 + TransportTime.GetHashCode(); } if (MaxOperationTime != null) { hashCode = hashCode * 59 + MaxOperationTime.GetHashCode(); } if (WaitingTime != null) { hashCode = hashCode * 59 + WaitingTime.GetHashCode(); } if (NoVehicles != null) { hashCode = hashCode * 59 + NoVehicles.GetHashCode(); } if (NoUnassigned != null) { hashCode = hashCode * 59 + NoUnassigned.GetHashCode(); } if (Routes != null) { hashCode = hashCode * 59 + Routes.GetHashCode(); } if (Unassigned != null) { hashCode = hashCode * 59 + Unassigned.GetHashCode(); } return(hashCode); } }