public CarView() { InitializeComponent(); CarBrand.SetBinding(Image.SourceProperty, new Binding("Car.Brand", source: this)); //if(Car.CarImage_1 != null || Car.CarImage_1.Any()) //{ // var stream1 = new MemoryStream(Car.CarImage_1 ?? new byte[] { }); // CarImage.Source = ImageSource.FromStream(() => stream1); //} CarImage.SetBinding(CachedImage.SourceProperty, new Binding("Car.CarImageSource", source: this)); CarName.SetBinding(Label.TextProperty, new Binding("Car.Name", source: this)); //carouselForCarImages.SetBinding(CarouselViewControl.ItemsSourceProperty, new Binding("Car.Images", source: this)); Available.SetBinding(Button.TextProperty, new Binding("Car.Available", BindingMode.Default, new FromBoolToAvailableText(), source: this)); Available.SetBinding(Button.OpacityProperty, new Binding("Car.Available", BindingMode.Default, new FromBoolToAvailableOpacity(), source: this)); Available.SetBinding(Button.BackgroundColorProperty, new Binding("Car.Available", BindingMode.Default, new FromBoolToAvailableBackgroundColor(), source: this)); this.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(() => { this.Clicked?.Invoke(this, EventArgs.Empty); if (Command != null) { if (Command.CanExecute(CommandParameter)) { Command.Execute(CommandParameter); } } }) }); }
public VehicleContent(CarName car, int price, string information, VehicleType vehicle) { CarName = car; PriceValue = price; Information = information; TypeofVehicle = vehicle; }
public override int GetHashCode() { unchecked { return(((CarName != null ? CarName.GetHashCode() : 0) * 397) ^ (ClassName != null ? ClassName.GetHashCode() : 0)); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + IdCar.GetHashCode(); if (CarMake != null) { hashCode = hashCode * 59 + CarMake.GetHashCode(); } if (CarName != null) { hashCode = hashCode * 59 + CarName.GetHashCode(); } if (CarNr != null) { hashCode = hashCode * 59 + CarNr.GetHashCode(); } if (CarType != null) { hashCode = hashCode * 59 + CarType.GetHashCode(); } if (CarClass != null) { hashCode = hashCode * 59 + CarClass.GetHashCode(); } return(hashCode); } }
public CarModel(CarManufacturer carManufacturer, CarName carName, CarColor carColor, int carConstructionYear) { this.carType = CarType.Auto; this.carManufacturer = carManufacturer; this.carName = carName; this.carColor = carColor; this.CarConstructionYear = carConstructionYear; }
public Car(CarName name, int speed, float price, bool isRealMoneyPurchase, string productId) { Name = name; Speed = speed; Price = price; IsRealMoneyPurchase = isRealMoneyPurchase; ProductId = productId; }
private void AddToListOnClick(object sender, EventArgs e) { // Reset Background Color of textbox CarName.BackColor = Color.White; CarColor.BackColor = Color.White; Price.BackColor = Color.White; // Check if textbox are emty. Show error Message // and change background color of textbox if empty if (String.IsNullOrEmpty(CarName.Text) || String.IsNullOrEmpty(CarColor.Text) || String.IsNullOrEmpty(Price.Text)) { MessageBox.Show("Please make sure that all fields are not empty"); if (String.IsNullOrEmpty(CarName.Text)) { CarName.BackColor = Color.PaleVioletRed; } else if (String.IsNullOrEmpty(CarColor.Text)) { CarColor.BackColor = Color.PaleVioletRed; } else { Price.BackColor = Color.PaleVioletRed; } return; } // Check if numeric values are entered in the "Price" field // If not, show message and change background color of textbox if (!decimal.TryParse(Price.Text, out decimal parsedDecimal)) { MessageBox.Show(@"Please enter only numbers in the ""Price"" Field"); Price.BackColor = Color.PaleVioletRed; return; } // Add information to CarList Car car = new Car { Name = CarName.Text, Color = CarColor.Text, Price = parsedDecimal }; CarList.Add(car); // Clear textboxes and dropdown CarName.Clear(); CarColor.ResetText(); Price.Clear(); // Add the last item (the newest item) to the ListBox MyCarsList.Items.Add(String.Format(" - {0}, {1}, {2}\r\n", CarList[CarList.Count - 1].Name, CarList[CarList.Count - 1].Color, CarList[CarList.Count - 1].Price)); }
//Simple Factory static ICar GetCar(CarName carName) { ICar car = null; switch (carName) { case CarName.Pride: car = new Pride(); break; case CarName.Bmw: car = new Bmw(); break; } return(car); }
public void WriteToFiles(FileSet files, int carNumber) { List <long> indexes = new List <long>(3); foreach (Stream file in files.CarInfoFiles) { file.Position = (carNumber + 1) * 8; file.WriteUInt(CarName.ToCarID()); long index = file.Length; file.WriteUShort((ushort)index); indexes.Add(index); file.WriteUShort(GetColourCountAndRegionBlockingFlags()); } WriteColoursToFiles(files, indexes, carNumber); WriteName(files.JPCarInfo, JPName, indexes[0], Colours.Count); WriteName(files.USCarInfo, USName, indexes[1], Colours.Count); WriteName(files.EUCarInfo, EUName, indexes[2], Colours.Count); }
/// <summary> /// Returns true if Car instances are equal /// </summary> /// <param name="other">Instance of Car to be compared</param> /// <returns>Boolean</returns> public bool Equals(Car other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( IdCar == other.IdCar || IdCar.Equals(other.IdCar) ) && ( CarMake == other.CarMake || CarMake != null && CarMake.Equals(other.CarMake) ) && ( CarName == other.CarName || CarName != null && CarName.Equals(other.CarName) ) && ( CarNr == other.CarNr || CarNr != null && CarNr.Equals(other.CarNr) ) && ( CarType == other.CarType || CarType != null && CarType.Equals(other.CarType) ) && ( CarClass == other.CarClass || CarClass != null && CarClass.Equals(other.CarClass) )); }
public GameData() { coinsOwned = InitialCoinAmount; carIndexToOwnership = new Ownership[TotalCarCount]; foreach (var car in CarList.List) { carIndexToOwnership[(int)car.Name] = Ownership.NotOwned; } carIndexToOwnership[(int)CarList.CarSedan.Name] = Ownership.Owned; backgroundNameToOwnership = new Ownership[TotalBackgroundCount]; foreach (var background in BackgroundList.List) { backgroundNameToOwnership[(int)background.Name] = Ownership.NotOwned; } backgroundNameToOwnership[(int)BackgroundList.BlueGrassBackground.Name] = Ownership.Owned; carInUseName = CarName.Sedan; subscriptionType = SubscriptionType.NoSubscription; backgroundInUseName = BackgroundName.BlueGrass; }
public SuperCarModel(CarManufacturer carManufacturer, CarName carName, CarColor carColor, int carConstructionYear) : base(carManufacturer, carName, carColor, carConstructionYear) { base.carType = CarType.SportAuto; }
private void LoadMetadata(SpecDB db) { if (TableName.StartsWith("CAR_NAME_")) { string locale = TableName.Split('_')[2]; if (locale.Equals("ALPHABET") || locale.Equals("JAPAN")) { locale = "UnistrDB.sdb"; } else { locale += "_StrDB.sdb"; } TableMetadata = new CarName(db.SpecDBFolderType, locale); } else if (TableName.StartsWith("CAR_VARIATION_")) { string locale = TableName.Split('_')[2]; if (locale.Equals("ALPHABET") || locale.Equals("JAPAN")) { locale = "UnistrDB.sdb"; } else { locale += "_StrDB.sdb"; } TableMetadata = new CarVariation(db.SpecDBFolderType, locale); } else if (TableName.StartsWith("COURSE_NAME_")) { string locale = TableName.Split('_')[2]; if (locale.Equals("ALPHABET") || locale.Equals("JAPAN")) { locale = "UnistrDB.sdb"; } else { locale += "_StrDB.sdb"; } TableMetadata = new CourseName(db.SpecDBFolderType, locale); } else if (TableName.StartsWith("VARIATION")) { string locale = "UnistrDB.sdb"; if (TableName.Length > 9) { locale = TableName.Substring(9); if (!locale.Equals("ALPHABET") && !locale.Equals("JAPAN")) { locale += "_StrDB.sdb"; } } TableMetadata = new Variation(db.SpecDBFolderType, locale); } else if (TableName.StartsWith("RIDER_EQUIPMENT")) { string locale = "UnistrDB.sdb"; if (TableName.Length > 15) { locale = TableName.Substring(15); if (!locale.Equals("ALPHABET") && !locale.Equals("JAPAN")) { locale += "_StrDB.sdb"; } } TableMetadata = new RiderEquipment(db.SpecDBFolderType, locale); } else { switch (TableName) { case "AIR_CLEANER": TableMetadata = new AirCleaner(db.SpecDBFolderType); break; case "ALLOW_ENTRY": TableMetadata = new AllowEntry(db.SpecDBFolderType); break; case "ARCADEINFO_NORMAL": case "ARCADEINFO_TUNED": TableMetadata = new ArcadeInfoNormal(db.SpecDBFolderType); break; case "ASCC": TableMetadata = new ASCC(db.SpecDBFolderType); break; case "BRAKE": TableMetadata = new Brake(db.SpecDBFolderType); break; case "BRAKECONTROLLER": TableMetadata = new BrakeController(db.SpecDBFolderType); break; case "CATALYST": TableMetadata = new Catalyst(db.SpecDBFolderType); break; case "CLUTCH": TableMetadata = new Clutch(db.SpecDBFolderType); break; case "COMPUTER": TableMetadata = new Computer(db.SpecDBFolderType); break; case "COURSE": TableMetadata = new Course(db.SpecDBFolderType); break; case "CAR_CUSTOM_INFO": TableMetadata = new CarCustomInfo(db.SpecDBFolderType); break; case "DEFAULT_PARAM": TableMetadata = new DefaultParam(db.SpecDBFolderType); break; case "DEFAULT_PARTS": TableMetadata = new DefaultParts(db.SpecDBFolderType); break; case "DISPLACEMENT": TableMetadata = new Displacement(db.SpecDBFolderType); break; case "DRIVETRAIN": TableMetadata = new Drivetrain(db.SpecDBFolderType); break; case "ENGINE": TableMetadata = new Engine(db.SpecDBFolderType); break; case "EXHAUST_MANIFOLD": TableMetadata = new ExhaustManifold(db.SpecDBFolderType); break; case "FLYWHEEL": TableMetadata = new Flywheel(db.SpecDBFolderType); break; case "GEAR": TableMetadata = new Gear(db.SpecDBFolderType); break; case "MAKER": TableMetadata = new Maker(db.SpecDBFolderType); break; case "MODEL_INFO": TableMetadata = new ModelInfo(db.SpecDBFolderType); break; case "PAINT_COLOR_INFO": TableMetadata = new PaintColorInfo(db.SpecDBFolderType); break; case "GENERIC_CAR": TableMetadata = new GenericCar(db.SpecDBFolderType); break; case "FRONTTIRE": TableMetadata = new FrontTire(db.SpecDBFolderType); break; case "REARTIRE": TableMetadata = new RearTire(db.SpecDBFolderType); break; case "RACINGMODIFY": TableMetadata = new RacingModify(db.SpecDBFolderType); break; case "CHASSIS": TableMetadata = new Chassis(db.SpecDBFolderType); break; case "INTAKE_MANIFOLD": TableMetadata = new IntakeManifold(db.SpecDBFolderType); break; case "LIGHTWEIGHT": TableMetadata = new Lightweight(db.SpecDBFolderType); break; case "LSD": TableMetadata = new Lsd(db.SpecDBFolderType); break; case "MUFFLER": TableMetadata = new Muffler(db.SpecDBFolderType); break; case "NATUNE": TableMetadata = new Natune(db.SpecDBFolderType); break; case "NOS": TableMetadata = new NOS(db.SpecDBFolderType); break; case "PROPELLERSHAFT": TableMetadata = new PropellerShaft(db.SpecDBFolderType); break; case "RACE": TableMetadata = new Race(db.SpecDBFolderType); break; case "STEER": TableMetadata = new Steer(db.SpecDBFolderType); break; case "SUPERCHARGER": TableMetadata = new Supercharger(db.SpecDBFolderType); break; case "SUSPENSION": TableMetadata = new Suspension(db.SpecDBFolderType); break; case "TIRECOMPOUND": TableMetadata = new TireCompound(db.SpecDBFolderType); break; case "TURBINEKIT": TableMetadata = new TurbineKit(db.SpecDBFolderType); break; case "GENERIC_ITEMS": TableMetadata = new GenericItems(db.SpecDBFolderType); break; case "TUNED_CARS": TableMetadata = new TunedCars(db.SpecDBFolderType); break; case "TUNER": TableMetadata = new Tuner(db.SpecDBFolderType); break; case "WHEEL": TableMetadata = new Wheel(db.SpecDBFolderType); break; // Unmapped, but havent seen having rows case "TCSC": TableMetadata = new TCSC(db.SpecDBFolderType); break; case "TIREFORCEVOL": TableMetadata = new TireForceVol(db.SpecDBFolderType); break; case "GENERIC_CAR_INFO": TableMetadata = new GenericCarInfo(db.SpecDBFolderType); break; case "INDEP_THROTTLE": TableMetadata = new IndepThrottle(db.SpecDBFolderType); break; case "INTERCOOLER": TableMetadata = new Intercooler(db.SpecDBFolderType); break; case "PORTPOLISH": TableMetadata = new PortPolish(db.SpecDBFolderType); break; case "WING": TableMetadata = new Wing(db.SpecDBFolderType); break; case "TUNER_LIST": TableMetadata = new TunerList(db.SpecDBFolderType); break; case "TIRESIZE": TableMetadata = new TireSize(db.SpecDBFolderType); break; case "ENEMY_CARS": TableMetadata = new EnemyCars(db.SpecDBFolderType); break; case "ENGINEBALANCE": TableMetadata = new EngineBalance(db.SpecDBFolderType); break; case "RIDER_SET_ASSIGN": TableMetadata = new RiderSetAssign(db.SpecDBFolderType); break; case "RIDER_SET": TableMetadata = new RiderSet(db.SpecDBFolderType); break; default: throw new NotSupportedException($"This table ({TableName}) is not yet mapped."); } for (int i = 0; i < TableMetadata.Columns.Count; i++) { TableMetadata.Columns[i].ColumnIndex = i; } } }
// Update car in use and apply the changes to the play page. public void UpdateCarInUse(CarList.Car targetCar) { carInUseName = targetCar.Name; _playerController.UpdateCarInUse(); }
// Return car object by name. public static Car GetCarByName(CarName carName) { return(List[(int)carName]); }