Esempio n. 1
0
        }//сделано

        public void LoadCarInfo(TGeneration CurrGeneration)
        {
            textBoxGenBegin.Text = CurrGeneration.GenBegin.ToString();
            textBoxGenEnd.Text   = CurrGeneration.GenEnd.ToString();


            for (int i = 0; i < Strings.StrTransmission.Count(); i++)
            {
                if (String.Equals(Strings.TransmissionStrToType(Strings.StrTransmission[i]), CurrGeneration.CurrCar.MainParams.Transmission))
                {
                    comboBoxTransmission.SelectedIndex = i;
                    break;
                }
            }
            EnginePower.Text = CurrGeneration.CurrCar.MainParams.EnginePower.ToString();

            textBoxMaxSpeed.Text  = CurrGeneration.CurrCar.MainParams.MaxSpeed.ToString();
            textBoxTimeTo100.Text = CurrGeneration.CurrCar.MainParams.TimeTo100.ToString();

            for (int i = 0; i < Strings.StrBodyType.Count(); i++)
            {
                if (String.Equals(Strings.BodyTypeStrToType(Strings.StrBodyType[i]), CurrGeneration.CurrCar.SizeParams.BodyType))
                {
                    comboBoxBodyType.SelectedIndex = i;
                    break;
                }
            }

            textBoxLength.Text = CurrGeneration.CurrCar.SizeParams.Length.ToString();

            textBoxWidth.Text     = CurrGeneration.CurrCar.SizeParams.Width.ToString();
            textBoxHeight.Text    = CurrGeneration.CurrCar.SizeParams.Height.ToString();
            textBoxMaxWeight.Text = CurrGeneration.CurrCar.SizeParams.MaxWeight.ToString();

            textBoxFullEquiepedWeight.Text = CurrGeneration.CurrCar.SizeParams.FullEquipedWeight.ToString();
            textBoxAmountOfDoors.Text      = CurrGeneration.CurrCar.SizeParams.AmountOfDoors.ToString();

            for (int i = 0; i < Strings.StrFuelType.Count(); i++)
            {
                if (String.Equals(Strings.FuelTypeStrToType(Strings.StrFuelType[i]), CurrGeneration.CurrCar.Fuel.FuelType))
                {
                    comboBoxFuelType.SelectedIndex = i;
                    break;
                }
            }

            textBoxFuelPer100_Town.Text = CurrGeneration.CurrCar.Fuel.FuelPer100_Town.ToString();
            textBoxFuelPer100_Road.Text = CurrGeneration.CurrCar.Fuel.FuelPer100_Road.ToString();

            if (CurrGeneration.CurrCar.Security.ABS)
            {
                checkBoxABS.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxABS.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Security.ESP)
            {
                checkBoxESP.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxESP.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Security.AntiSlip)
            {
                checkBoxAntiSlip.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxAntiSlip.CheckState = CheckState.Unchecked;
            }


            if (CurrGeneration.CurrCar.Security.DriverAirbag)
            {
                checkBoxAirbagDriver.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxAirbagDriver.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Security.AheadPassengerAirbag)
            {
                checkBoxAirbagAheadPassenger.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxAirbagAheadPassenger.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Comfort.CruiseControl)
            {
                checkBoxCruiseControl.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxCruiseControl.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Comfort.ServoWheel)
            {
                checkBoxServoWheel.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxServoWheel.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Comfort.OnBoardComputer)
            {
                checkBoxOnBoardComputer.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxOnBoardComputer.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Comfort.ParkingSystem)
            {
                checkBoxParkingSystem.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxParkingSystem.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Comfort.TintedGlass)
            {
                checkBoxTintedGlass.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxTintedGlass.CheckState = CheckState.Unchecked;
            }

            for (int i = 0; i < Strings.StrClimateControl.Count(); i++)
            {
                if (String.Equals(Strings.ClimateControlStrToType(Strings.StrClimateControl[i]), CurrGeneration.CurrCar.Comfort.ClimateControl))
                {
                    comboBoxClimateControl.SelectedIndex = i;
                    break;
                }
            }

            if (CurrGeneration.CurrCar.Multimedia.AudioSystem)
            {
                checkBoxAudioSystem.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxAudioSystem.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Multimedia.NavigationSystem)
            {
                checkBoxNavigationSystem.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxNavigationSystem.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.RainSensor)
            {
                checkBoxRainSensors.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxRainSensors.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.LightSensor)
            {
                checkBoxLightSensors.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxLightSensors.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.XenonLights)
            {
                checkBoxXenonLights.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxXenonLights.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.HeatingMirrors)
            {
                checkBoxMirrorHeating.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxMirrorHeating.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.LightAutoWashing)
            {
                checkBoxLightsAutowashing.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxLightsAutowashing.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.ObserveOpportunities.ElectricMirrorTuning)
            {
                checkBoxElectricMirrorTuning.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxElectricMirrorTuning.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.AntiHijack.CentralLock)
            {
                checkBoxCentralLock.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxCentralLock.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.AntiHijack.Signalisation)
            {
                checkBoxSignalisation.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxSignalisation.CheckState = CheckState.Unchecked;
            }

            textBoxAmountOfSeats.Text = CurrGeneration.CurrCar.Interior.AmountOfSeats.ToString();

            for (int i = 0; i < Strings.StrMaterial.Count(); i++)
            {
                if (String.Equals(Strings.MaterialStrToType(Strings.StrMaterial[i]), CurrGeneration.CurrCar.Interior.Material))
                {
                    comboBoxMaterial.SelectedIndex = i;
                    break;
                }
            }

            if (CurrGeneration.CurrCar.Interior.WheelHeating)
            {
                checkBoxWheelHeating.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxWheelHeating.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Interior.SeatHeating)
            {
                checkBoxSeatHeating.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxSeatHeating.CheckState = CheckState.Unchecked;
            }

            if (CurrGeneration.CurrCar.Interior.Sunroof)
            {
                checkBoxSunroof.CheckState = CheckState.Checked;
            }
            else
            {
                checkBoxSunroof.CheckState = CheckState.Unchecked;
            }

            for (int i = 0; i < Strings.StrSeatsTuning.Count(); i++)
            {
                if (String.Equals(Strings.SeatTuningStrToType(Strings.StrSeatsTuning[i]), CurrGeneration.CurrCar.Interior.DriverSeatTuning))
                {
                    comboBoxDriverSeatTuning.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < Strings.StrSeatsTuning.Count(); i++)
            {
                if (String.Equals(Strings.SeatTuningStrToType(Strings.StrSeatsTuning[i]), CurrGeneration.CurrCar.Interior.OtherSeatsTuning))
                {
                    comboBoxOtherSeatsTuning.SelectedIndex = i;
                    break;
                }
            }
        }
Esempio n. 2
0
        public bool SaveCarInfo(TGeneration CurrGeneration)
        {
            bool res, WholeRes;

            WholeRes = true;
            res      = Int32.TryParse(textBoxGenBegin.Text, out CurrGeneration.GenBegin);
            res      = res & Int32.TryParse(textBoxGenEnd.Text, out CurrGeneration.GenEnd);
            if (!res)
            {
                //MessageBox.Show(ProjectStrings.); уже делается
                WholeRes = false;
            }
            CurrGeneration.CurrCar.MainParams.Transmission = Strings.TransmissionStrToType(comboBoxTransmission.SelectedText);
            res = Double.TryParse(EnginePower.Text, out CurrGeneration.CurrCar.MainParams.EnginePower);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_EnginePower);
                WholeRes = false;
            }
            res = Int32.TryParse(textBoxMaxSpeed.Text, out CurrGeneration.CurrCar.MainParams.MaxSpeed);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_MaxSpeed);
                WholeRes = false;
            }

            res = Double.TryParse(textBoxTimeTo100.Text, out CurrGeneration.CurrCar.MainParams.TimeTo100);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_TimeTo100);
                WholeRes = false;
            }

            CurrGeneration.CurrCar.SizeParams.BodyType = Strings.BodyTypeStrToType(comboBoxBodyType.SelectedText);

            res = Int32.TryParse(textBoxLength.Text, out CurrGeneration.CurrCar.SizeParams.Length);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_Length);
                WholeRes = false;
            }

            res = Int32.TryParse(textBoxWidth.Text, out CurrGeneration.CurrCar.SizeParams.Width);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_Width);
                WholeRes = false;
            }

            res = Int32.TryParse(textBoxHeight.Text, out CurrGeneration.CurrCar.SizeParams.Height);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_Height);
                WholeRes = false;
            }

            res = Int32.TryParse(textBoxMaxWeight.Text, out CurrGeneration.CurrCar.SizeParams.MaxWeight);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_MaxWeight);
                WholeRes = false;
            }

            res = Int32.TryParse(textBoxFullEquiepedWeight.Text, out CurrGeneration.CurrCar.SizeParams.FullEquipedWeight);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_FullEquipedWeight);
                WholeRes = false;
            }

            res = Int32.TryParse(textBoxAmountOfDoors.Text, out CurrGeneration.CurrCar.SizeParams.AmountOfDoors);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_AmountOfDoors);
                WholeRes = false;
            }

            CurrGeneration.CurrCar.Fuel.FuelType = Strings.FuelTypeStrToType(comboBoxFuelType.SelectedText);

            res = Decimal.TryParse(textBoxFuelPer100_Town.Text, out CurrGeneration.CurrCar.Fuel.FuelPer100_Town);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_FuelPer100_Town);
                WholeRes = false;
            }

            res = Decimal.TryParse(textBoxFuelPer100_Road.Text, out CurrGeneration.CurrCar.Fuel.FuelPer100_Road);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_FuelPer100_Road);
                WholeRes = false;
            }

            CurrGeneration.CurrCar.Security.ABS                  = (checkBoxABS.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Security.ESP                  = (checkBoxESP.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Security.AntiSlip             = (checkBoxAntiSlip.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Security.ABS                  = (checkBoxABS.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Security.DriverAirbag         = (checkBoxAirbagDriver.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Security.AheadPassengerAirbag = (checkBoxAirbagAheadPassenger.CheckState == CheckState.Checked);

            CurrGeneration.CurrCar.Comfort.CruiseControl   = (checkBoxCruiseControl.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Comfort.ServoWheel      = (checkBoxServoWheel.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Comfort.OnBoardComputer = (checkBoxOnBoardComputer.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Comfort.ParkingSystem   = (checkBoxParkingSystem.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Comfort.TintedGlass     = (checkBoxTintedGlass.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Comfort.ClimateControl  = Strings.ClimateControlStrToType(comboBoxClimateControl.SelectedText);

            CurrGeneration.CurrCar.Multimedia.AudioSystem      = (checkBoxAudioSystem.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Multimedia.NavigationSystem = (checkBoxNavigationSystem.CheckState == CheckState.Checked);

            CurrGeneration.CurrCar.ObserveOpportunities.RainSensor           = (checkBoxRainSensors.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.ObserveOpportunities.LightSensor          = (checkBoxLightSensors.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.ObserveOpportunities.XenonLights          = (checkBoxXenonLights.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.ObserveOpportunities.HeatingMirrors       = (checkBoxMirrorHeating.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.ObserveOpportunities.LightAutoWashing     = (checkBoxLightsAutowashing.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.ObserveOpportunities.ElectricMirrorTuning = (checkBoxElectricMirrorTuning.CheckState == CheckState.Checked);

            CurrGeneration.CurrCar.AntiHijack.CentralLock   = (checkBoxCentralLock.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.AntiHijack.Signalisation = (checkBoxSignalisation.CheckState == CheckState.Checked);

            res = Int32.TryParse(textBoxAmountOfSeats.Text, out CurrGeneration.CurrCar.Interior.AmountOfSeats);
            if (!res)
            {
                MessageBox.Show(ProjectStrings.InvalidInput_AmountOfSeats);
                WholeRes = false;
            }
            CurrGeneration.CurrCar.Interior.Material     = Strings.MaterialStrToType(comboBoxMaterial.SelectedText);
            CurrGeneration.CurrCar.Interior.WheelHeating = (checkBoxWheelHeating.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Interior.SeatHeating  = (checkBoxSeatHeating.CheckState == CheckState.Checked);
            CurrGeneration.CurrCar.Interior.Sunroof      = (checkBoxSunroof.CheckState == CheckState.Checked);

            CurrGeneration.CurrCar.Interior.DriverSeatTuning = Strings.SeatTuningStrToType(comboBoxDriverSeatTuning.SelectedText);
            CurrGeneration.CurrCar.Interior.OtherSeatsTuning = Strings.SeatTuningStrToType(comboBoxOtherSeatsTuning.SelectedText);

            return(WholeRes);
        }