private void DisplayResult(ICar newCar) { StringBuilder sb = new StringBuilder(); var foundedCars = DataSource.GetCars() .Where(c => c.Producer == newCar.Producer) .Where(c => c.Model == newCar.Model) .Where(c => c.EngineType == newCar.EngineType) .Where(c => c.Extres.HasAirCondition == newCar.Extres.HasAirCondition) .Where(c => c.Extres.HasAlarm == newCar.Extres.HasAlarm) .Where(c => c.Extres.HasElectricalGlasses == newCar.Extres.HasElectricalGlasses) .ToList(); for (int i = 0; i < foundedCars.Count; i++) { sb.AppendLine("<ul><li>Producer: " + foundedCars[i].Producer + "</li>"); sb.AppendLine("<li>Model: " + foundedCars[i].Model + "</li>"); sb.AppendLine("<li>Engin Type: " + foundedCars[i].EngineType + "</li>"); sb.AppendLine("<h6>Extras</h6><ul>"); sb.AppendLine("<li> HasAirCondition: " + (foundedCars[i].Extres.HasAirCondition ? "Yes" : "No").ToString() + "</li>"); sb.AppendLine("<li> HasAlarm: " + (foundedCars[i].Extres.HasAlarm ? "Yes" : "No").ToString() + "</li>"); sb.AppendLine("<li> HasElectricalGlasses: " + (foundedCars[i].Extres.HasElectricalGlasses ? "Yes" : "No").ToString() + "</li></ul></ul>"); sb.AppendLine("<br/>"); } if (foundedCars.Count == 0) { this.LiteralContainer.Text = "No results"; } else { this.LiteralContainer.Text = sb.ToString(); } }
/// <summary> /// Returns top speed in km/h /// </summary> /// <param name="sim"></param> /// <param name="car"></param> /// <returns></returns> public double TopSpeed(ISimulator sim, ICar car) { if (sim.Garage != null && sim.Garage.Available) { if (car == null) { // Look up car. try { car = sim.Garage.SearchCar(sim.Drivers.Player.CarClass, sim.Drivers.Player.CarModel); }catch(Exception ex) { } if (car == null) return TopSpeed_Stock; car.ScanAerodynamics(); car.ScanEngine(); if (car.Engine == null || car.Aerodynamics == null) return TopSpeed_Stock; } double power = MaximumPower(sim, car); double aero = car.Aerodynamics.GetAerodynamicDrag(sim.Setup); return 3.6 * Math.Pow(power * 1000.0 / aero, 1 / 3.0); } else { return TopSpeed_Stock; } }
public CarEngineTools(ICar c) { if (c != null) { Car = c; Car.ScanEngine(); } }
/// <summary> /// 默认构造函数 /// </summary> /// <param name="carService">站点下车辆基础信息接口</param> /// <param name="buyService">车辆求购保存读取接口</param> /// <param name="accountService">帐号服务接口</param> public CarBuyController(ICar carService , IBuyCar buyService, IAccountService accountService) { this.carService = carService; this.buyService = buyService; this.accountService = accountService; }
public PIDSteeringWheelAngleRegulator(ICar car) { Car = car; regulator = new PIDRegulator(new Settings(), "steering wheel angle regulator"); car.evTargetSteeringWheelAngleChanged += new TargetSteeringWheelAngleChangedEventHandler(car_evTargetSteeringWheelAngleChanged); car.CarComunicator.evSteeringWheelAngleInfoReceived += new SteeringWheelAngleInfoReceivedEventHandler(CarComunicator_evSteeringWheelAngleInfoReceived); }
public CarTransferController(ICar carService, ITransferCar buyService, IAccountService accountService) { this.carService = carService; this.transferService = buyService; this.accountService = accountService; }
static bool CheckCar(ICar car) { if (!CheckDriver(car.Driver) | CheckEngine(car.Engine) | !CheckFuel(car.Fuel)) { return false; } return true; }
public SimpleBrakeRegulator(ICar car) { ICar = car; regulator = new SimpleRegulator(new Settings(), "brake PID regulator"); ICar.SpeedRegulator.evNewSpeedSettingCalculated += SpeedRegulator_evNewSpeedSettingCalculated; ICar.CarComunicator.evBrakePositionReceived += CarComunicator_evBrakePositionReceived; evNewBrakeSettingCalculated += PIDBrakeRegulator_evNewBrakeSettingCalculated; ICar.evAlertBrake += ICar_evAlertBrake; }
MFCSPeedRegulator(ICar car, CarSimulator.CarModel carModel) { Car = car; CarModel = carModel; RegisterModelForSteeringEvents(); ModelThread = new Thread(ContinousCarSimulation); ModelThread.Start(); }
public double Drive(ICar car, IRoute route) { double journeyDuration = 0; foreach (IPlace place in route.GetOrderedPlaces()) { IDrivingStrategy drivingStrategy = SelectDrivingStrategy(place); journeyDuration += drivingStrategy.Execute(car, place, journeyDuration); } return journeyDuration; }
public FakeCarCommunicator(ICar car) { ICar = car; //mFakeThread = new System.Threading.Thread(new ThreadStart(mFakeThreadTasks)); //mFakeThread.Start(); model = new CarModel(this); communicationThread = new Thread(ContinousCommunication); communicationThread.Start(); }
public PIDBrakeRegulator(ICar car) { ICar = car; regulator = new PIDRegulator(new Settings(), "brake PID regulator"); ICar.evTargetSpeedChanged += new TargetSpeedChangedEventHandler(ICar_evTargetSpeedChanged); ICar.SpeedRegulator.evNewSpeedSettingCalculated += new NewSpeedSettingCalculatedEventHandler(SpeedRegulator_evNewSpeedSettingCalculated); ICar.CarComunicator.evBrakePositionReceived += new BrakePositionReceivedEventHandler(CarComunicator_evBrakePositionReceived); evNewBrakeSettingCalculated += new NewBrakeSettingCalculatedEventHandler(PIDBrakeRegulator_evNewBrakeSettingCalculated); ICar.evAlertBrake += new EventHandler(ICar_evAlertBrake); }
/// <summary> /// 默认构造函数 /// </summary> /// <param name="site">站点基础信息接口</param> /// <param name="channel">一级频道服务接口 配合物品二级列表获取</param> /// <param name="car">站点下车辆基础信息接口</param> /// <param name="house">站点下房屋基础信息接口</param> public SiteCache(ISite site, IChannelService channel, ICar car, IHouse house) { this.site = site; this.channel = channel; this.car = car; //this.goods = goods;//因goods 采用二级频道 所以使用IChannelService this.house = house; }
public FakeCarCommunicator(ICar car) { ICar = car; //mFakeThread = new System.Threading.Thread(new ThreadStart(mFakeThreadTasks)); //mFakeThread.Start(); model = new CarModel(this); timer.Interval = TIMER_INTERVAL_IN_MS; timer.Tick += new EventHandler(timer_Tick); timer.Start(); }
public void Upgrade(ICar car) { var coordinates = new Coordinates(1, 2); if (car.Content.ContainsKey(coordinates)) { car.Content[coordinates] = Engine; } else { car.Content.Add(coordinates, Engine); } }
public PIDSpeedRegulator(ICar parent) { Car = parent; CarComunicator = parent.CarComunicator; regulator = new PIDRegulator(new Settings(), "speed PID regulator"); Car.evAlertBrake += new EventHandler(Car_evAlertBrake); Car.evTargetSpeedChanged += new TargetSpeedChangedEventHandler(Car_evTargetSpeedChanged); evNewSpeedSettingCalculated += new NewSpeedSettingCalculatedEventHandler(PIDSpeedRegulator_evNewSpeedSettingCalculated); CarComunicator.evSpeedInfoReceived += new SpeedInfoReceivedEventHander(CarComunicator_evSpeedInfoReceived); }
public double Execute(ICar car, IPlace place, double journeyDuration) { ITrafficLight trafficLight = (ITrafficLight)place; double timetaken = 0; double waitingTime = trafficLight.GetWaitingTime(journeyDuration); if (waitingTime > 0) { timetaken += car.Stop(); timetaken += waitingTime; timetaken += car.Start(); } return timetaken; }
public ICarModel GetCarModel(ICar car) { var carModel = new CarModel { Color = car.Color, Id = car.Id, OptionsMacroText = car.OptionsMacroText, Price = car.Price.HasValue ? car.Price.Value : 0.00M, SportsPackage = car.SportsPackage.HasValue ? car.SportsPackage.Value : false, VehicleModel = car.Model }; return (ICarModel) carModel; }
public RealCarCommunicator(ICar parent) { ICar = parent; extentionCardCommunicator = new USB4702(); servoDriver = new ServoDriver(); angleAndSpeedMeter = new RS232Controller(this); //TODO: make thread for every initialization //its actually done for angleAndSpeedMeter extentionCardCommunicator.Initialize(); servoDriver.Initialize(); angleAndSpeedMeter.Initialize(); SpeedMeasuringTimer.Interval = SPEED_MEASURING_TIMER_INTERVAL_IN_MS; SpeedMeasuringTimer.Tick += new EventHandler(SpeedMeasuringTimer_Tick); SpeedMeasuringTimer.Start(); }
/// <summary> /// Returns power in HP /// </summary> /// <param name="sim"></param> /// <param name="car"></param> /// <returns></returns> public double MaximumPower(ISimulator sim, ICar car) { if (sim.Garage == null) return 0; if (car == null) { // Look up car. car = sim.Garage.SearchCar(sim.Drivers.Player.CarClass, sim.Drivers.Player.CarModel); if (car == null) return 0; car.ScanEngine(); if (car.Engine == null ) return 0; } return car.Engine.GetMaximumPower(); }
public RealCarCommunicator(ICar parent) { ICar = parent; servoDriver = new ServoDriver(); deviceManager.RegisterDevice(servoDriver); //angleAndSpeedMeter = new SafeRS232Controller(this, new SafeRS232Communicator("COM4")); //deviceManager.RegisterDevice(angleAndSpeedMeter); angleAndSpeedMeter = new CarController_old.RS232Controller(this); deviceManager.RegisterDevice(angleAndSpeedMeter); extentionCardCommunicator = new USB4702(); deviceManager.RegisterDevice(extentionCardCommunicator); speedometer = new Speedometer(extentionCardCommunicator); deviceManager.RegisterDevice(speedometer); gearboxController = new GearboxController(extentionCardCommunicator, this); deviceManager.RegisterDevice(gearboxController); speedometer.evSpeedInfoReceived += speedometer_evSpeedInfoReceived; }
public Player(ICar car, IPlayerRole role) { Car = car; Role = role; }
public double Execute(ICar car, IPlace place, double journeyDuration) { IRoadStretch roadStretch = (IRoadStretch)place; return car.Run(roadStretch.GetRoadStretchLength(), roadStretch.GetRoadSpeed()); }
public Beach(ICar car) { Car = car; }
public void Move(ICar car, string name) { Console.WriteLine($"{name} broken"); }
private ICar car;//定义一个私有变量保存抽象 //实现接口 public void SetCar(ICar car) { this.car = car; }
public CarDecorator(ICar car) { Car = car; }
public void GetNextGridPoint(ITrack track, ICar car, IList <Point> routeGridPoints, Point middleGridPoint, out uint nrBacktracks, out Point gridPoint) { mComputerDriver.GetNextGridPoint(track, car, routeGridPoints, middleGridPoint, out nrBacktracks, out gridPoint); }
public CarAccessoriesDecorator(ICar car) { _car = car; }
static void Main(string[] args) { ToyForKR toyForKR = new ToyForKR(); //toyForKR.Greet(); Console.WriteLine(); ToyForUS toyForUS = new ToyForUS(); //toyForUS.GreetFirst(); Console.WriteLine(); ToyForCN toyForCN = new ToyForCN(); //toyForCN.GreetForFirst(); // 인터페이스 toyForKR.DoGreet(); toyForUS.DoGreet(); toyForCN.DoGreet(); IToy[] Toys = { toyForKR, toyForUS, toyForCN }; for (int i = 0; i < Toys.Length; i++) { Toys[i].DoGreet(); } Console.WriteLine(); // 인터페이스 상속 Robot robot = new Robot(); robot.DoWalk(); robot.DoFly(); IRobot oldRobot = robot as IRobot; oldRobot.DoWalk(); //oldRobot.DoFly(); INewGenerationRobot newGenerationRobot = robot as INewGenerationRobot; newGenerationRobot.DoWalk(); newGenerationRobot.DoFly(); Console.WriteLine(); // 인터페이스 다중 상속 MySuperCar mySuperCar = new MySuperCar(); mySuperCar.DoDriving(); mySuperCar.DoFlight(); ICar myCar = mySuperCar as ICar; myCar.DoDriving(); // myCar.DoFlight(); IAirplane myAirplane = mySuperCar as IAirplane; //myAirplane.DoDriving(); myAirplane.DoFlight(); }
public BasicAccessoriesDecorator(ICar aCar) : base(aCar) { }
public HomeController(ILogger <HomeController> logger, ICar car) { _logger = logger; _car = car; }
public void Reset() { _car = new ConcreteCar(""); }
public void SetUp() { _car = Substitute.For<ICar>(); }
public void SelectCar(ICar iCar, ref DataTable datatable) { _iDataDis.SelectCar(iCar, ref datatable); }
protected CarDecorator(ICar car) { Car = car; }
public void Load(ICar car) { CarEngineTools t = new CarEngineTools(car); t.Scan(); Load(car, t); }
public Driver(ICar car) { _car = car; }
public OfferPrice(ICar car) : base(car) { }
public StreetRacer(string username, ICar car) : base(username, "aggressive", 10, car) { }
public CarDecorator(ICar Car) { car = Car; }
private void PerformCrashTests(ICar car) { Logger.Write($"Performing crash tests for {car.Name} in FactoryMethod.UkAutomobileShowroom."); }
public CountryRoad(ICar car) { Car = car; }
public AttackCar(ICar decoratedCar) { _decoratedCar = decoratedCar; }
public HomeController(ICar car) { _car = car; }
public MultiFunctionalCar3(ICar car, IAirplane airplane) { _car = car; _airplane = airplane; }
public LittleKingdom(ICar car, IGarage garage) { Car = car; Garage = garage; }
static void PrintInfo(ICar car) { Console.WriteLine("Here is a {0} {1} {2} {3}", car.Color.Name, car.Year, car.Make, car.Model); }
public void InsertCar(ICar iCar) { _iDataDis.InsertCar(iCar); }
public ConsoleLoggerDecorator(ICar car, IConsoleLogger logger, int number) { this.car = car; this.logger = logger; this.number = number; }
public DieselCarDecorator(ICar car) : base(car) { }
public abstract void HandlePurchase(ICar purchase);
public void DeleteCarFromList(string model) { ICar car = GetCarFromList(model); _carsList.Remove(car); }
private void PerformSafetyChecks(ICar car) { Logger.Write($"Performing safety checks for {car.Name} in FactoryMethod.UkAutomobileShowroom."); }
public void Load(ICar car, CarEngineTools t) { if (car != null && car.Engine != null) { this.BackColor = Color.Black; eng = car.Engine; tools = t; _Settings_mode = 0; _Settings_speed = 0; _Settings_throttle = 1; this.Invalidate(); cb_mode.Items.Clear(); cb_mode.DisplayMember = "mode"; cb_mode.ValueMember = "index"; foreach (KeyValuePair<int, string> mode in car.Engine.EngineModes) { cb_mode.Items.Add(new ucSelectModel_EngineCurve_Mode(mode.Key, mode.Value)); } if (cb_mode.Items.Count >= _Settings_mode) cb_mode.SelectedIndex = _Settings_mode; } }
public CarProxy(Driver driver) { _driver = driver; _realCar = new Car(); }
public AirConditionner(ICar car) : base(car) { this.car = car; }
/// <summary> /// 构造方法注入 /// </summary> /// <param name="onecar">传入要注入的对象</param> public Person(ICar onecar) { this.car = onecar; }
private static string SerializeCar(ICar car) { var jsonObject = JsonObject.Parse(car.ToJson()); if (jsonObject.ContainsKey("__type")) jsonObject.Remove("__type"); return jsonObject.ToJson(); }
public JapanCarFactory(ICar car) { this.Car = car; }