private async Task Join(object o) {
var carEntry = CarsView?.CurrentItem as CarEntry;
if (carEntry == null) return;
var carId = carEntry.CarObject.Id;
var correctId = CarIds.FirstOrDefault(x => string.Equals(x, carId, StringComparison.OrdinalIgnoreCase));
if (BookingMode && !ReferenceEquals(o, ActualJoin) && !ReferenceEquals(o, ForceJoin)) {
if (_factory == null) {
Logging.Error("Booking: UI factory is missing");
return;
}
PrepareBookingUi();
ProcessBookingResponse(await Task.Run(() => KunosApiProvider.TryToBook(Ip, PortC, Password, correctId, carEntry.AvailableSkin?.Id,
DriverName.GetOnline(), "")));
return;
}
DisposeHelper.Dispose(ref _ui);
IsBooked = false;
BookingErrorMessage = null;
var properties = new Game.StartProperties(new Game.BasicProperties {
CarId = carId,
CarSkinId = carEntry.AvailableSkin?.Id,
TrackId = Track?.Id,
TrackConfigurationId = Track?.LayoutId
}, null, null, null, new Game.OnlineProperties {
RequestedCar = correctId,
ServerIp = Ip,
ServerName = DisplayName,
ServerPort = PortT,
ServerHttpPort = PortC,
Guid = SteamIdHelper.Instance.Value,
Password = Password
});
await GameWrapper.StartAsync(properties);
var whatsGoingOn = properties.GetAdditional<AcLogHelper.WhatsGoingOn>();
WrongPassword = whatsGoingOn?.Type == AcLogHelper.WhatsGoingOnType.OnlineWrongPassword;
if (whatsGoingOn == null) RecentManager.Instance.AddRecentServer(OriginalInformation);
}