void UpdateStartTrip(bool setFirst = false) { StartTrip.Clear(); StartTrip.Add(new TripAdvisorViewModel("00:00", string.Empty)); foreach (var el in PCHandler.Instance.ListTrip.Where(o => o.StartEng >= StartDate && o.StartEng <= StartDate.AddHours(23).AddMinutes(59))) { StartTrip.Add(el); } if (setFirst) { SelectedStart = StartTrip[0]; } }
private void TripSimulator(Place location, Place destination) { Thread.Sleep((int)Town.GetTimeBetweenPlaces(ItLocation, location) * 100); ComeToTheClient?.Invoke(this, new UserEventArgs($"Your {Car} car has just gone to you!", CurrentClient, this)); var r = new Random(); Thread.Sleep(r.Next(2, 4) * 1000); StartTrip?.Invoke(this, new UserEventArgs($"{Name} has successfully taken the {CurrentClient.Name} {CurrentClient.PhoneNumber} client", CurrentClient, this)); Thread.Sleep((int)Town.GetTimeBetweenPlaces(location, destination) * 100); ItStatus = Status.Free; ItLocation = new Place("Base", 0.0, 0.0); EndTrip?.Invoke(this, new UserEventArgs($"{Name} has successfully given a lift to the {CurrentClient.Name} {CurrentClient.Id} client", CurrentClient, this)); CurrentClient = null; }