Beispiel #1
0
        private void RemoveUnitDialog(int fractionIndex, ListBox fractionList, string fractionName)
        {
            int          targetIndx = fractionList.SelectedIndex;
            FractionUnit target     = (FractionUnit)(fractionList).SelectedItem;

            if (MessageBox.Show(this, string.Format("Are you sure you wish to remove {0} from the {1} fraction? This can break existing scripts. Please make a backup of your map!", target.UnitName, fractionName), "Remove unit", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ((Scenario)scenarioList.SelectedItem).m_fractions[fractionIndex].Units.RemoveAt(targetIndx);

                fractionList.DataSource    = null;
                fractionList.DataSource    = ((Scenario)scenarioList.SelectedItem).m_fractions[fractionIndex].Units;
                fractionList.DisplayMember = "unitName";
            }
        }
        private void inputTypeClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClassUnitType selectedClass = (ClassUnitType)((ComboBox)sender).SelectedItem;
            UnitClass     c             = selectedClass.UnitClass;

            switch (c)
            {
            case UnitClass.VehicleUnit:
                NewUnit = new VehicleFractionUnit(selectedClass.UnitType, 0, 0, 0, false, 0, GetNextUnitName(c, selectedClass.UnitType, selectedClass.UnitTypeName));
                break;

            default:
                NewUnit = new GenericFractionUnit(selectedClass.UnitType, 0, 0, 0, false, 1, GetNextUnitName(c, selectedClass.UnitType, selectedClass.UnitTypeName));
                break;
            }

            propertyGridValues.SelectedObject = NewUnit;
        }
Beispiel #3
0
        public void UpdateUnitSystem(UnitSystem unitSystem)
        {
            this.unitSystem = unitSystem;
            this.TextBox.Clear();
            if (unitSystem != null)
            {
                this.textBoxUnitSystem.ScrollBars = System.Windows.Forms.ScrollBars.None;

                string temperature        = "Temperature: \t\t" + TemperatureUnit.GetUnitAsString(unitSystem.TemperatureUnitType);
                string pressure           = "Pressure: \t\t\t" + PressureUnit.GetUnitAsString(unitSystem.PressureUnitType);
                string massFlowRate       = "Mass Flow Rate: \t\t" + MassFlowRateUnit.GetUnitAsString(unitSystem.MassFlowRateUnitType);
                string volumeFlowRate     = "Volume Flow Rate: \t\t" + VolumeFlowRateUnit.GetUnitAsString(unitSystem.VolumeFlowRateUnitType);
                string moistureContent    = "Moisture Content: \t\t" + MoistureContentUnit.GetUnitAsString(unitSystem.MoistureContentUnitType);
                string relativeHumidity   = "Fraction: \t\t\t" + FractionUnit.GetUnitAsString(unitSystem.FractionUnitType);
                string enthalpy           = "Specific Energy: \t\t" + SpecificEnergyUnit.GetUnitAsString(unitSystem.SpecificEnergyUnitType);
                string specificHeat       = "Specific Heat: \t\t" + SpecificHeatUnit.GetUnitAsString(unitSystem.SpecificHeatUnitType);
                string energy             = "Energy: \t\t\t" + EnergyUnit.GetUnitAsString(unitSystem.EnergyUnitType);
                string power              = "Power: \t\t\t" + PowerUnit.GetUnitAsString(unitSystem.PowerUnitType);
                string density            = "Density: \t\t\t" + DensityUnit.GetUnitAsString(unitSystem.DensityUnitType);
                string dynamicViscosity   = "Dynamic Viscosity: \t\t" + DynamicViscosityUnit.GetUnitAsString(unitSystem.DynamicViscosityUnitType);
                string kinematicViscosity = "Kinematic Viscosity: \t" + KinematicViscosityUnit.GetUnitAsString(unitSystem.KinematicViscosityUnitType);
                string conductivity       = "Thermal Conductivity: \t" + ThermalConductivityUnit.GetUnitAsString(unitSystem.ThermalConductivityUnitType);
                string diffusivity        = "Diffusivity: \t\t" + DiffusivityUnit.GetUnitAsString(unitSystem.DiffusivityUnitType);
                string mass                          = "Mass: \t\t\t" + MassUnit.GetUnitAsString(unitSystem.MassUnitType);
                string length                        = "Length: \t\t\t" + LengthUnit.GetUnitAsString(unitSystem.LengthUnitType);
                string area                          = "Area: \t\t\t" + AreaUnit.GetUnitAsString(unitSystem.AreaUnitType);
                string volume                        = "Volume: \t\t\t" + VolumeUnit.GetUnitAsString(unitSystem.VolumeUnitType);
                string time                          = "Time: \t\t\t" + TimeUnit.GetUnitAsString(unitSystem.TimeUnitType);
                string smallLength                   = "Small Length: \t\t" + SmallLengthUnit.GetUnitAsString(unitSystem.SmallLengthUnitType);
                string microLength                   = "Micro Length: \t\t" + MicroLengthUnit.GetUnitAsString(unitSystem.MicroLengthUnitType);
                string liquidHead                    = "Liquid Head: \t\t" + LiquidHeadUnit.GetUnitAsString(unitSystem.LiquidHeadUnitType);
                string volumeRateFlowLiquids         = "Volume Rate Flow Liquids: \t" + VolumeRateFlowLiquidsUnit.GetUnitAsString(unitSystem.VolumeRateFlowLiquidsUnitType);
                string volumeRateFlowGases           = "Volume Rate Flow Gases: \t" + VolumeRateFlowGasesUnit.GetUnitAsString(unitSystem.VolumeRateFlowGasesUnitType);
                string heatTransferCoeff             = "Heat Transfer Coeff.: \t" + HeatTransferCoefficientUnit.GetUnitAsString(unitSystem.HeatTransferCoefficientUnitType);
                string surfaceTension                = "Surface Tension: \t\t" + SurfaceTensionUnit.GetUnitAsString(unitSystem.SurfaceTensionUnitType);
                string velocity                      = "Velocity: \t\t\t" + VelocityUnit.GetUnitAsString(unitSystem.VelocityUnitType);
                string foulingFactor                 = "Fouling Factor: \t\t" + FoulingFactorUnit.GetUnitAsString(unitSystem.FoulingFactorUnitType);
                string specificVolume                = "Specific Volume: \t\t" + SpecificVolumeUnit.GetUnitAsString(unitSystem.SpecificVolumeUnitType);
                string massVolumeConcentration       = "Mass Volume Concentration: \t" + MassVolumeConcentrationUnit.GetUnitAsString(unitSystem.MassVolumeConcentrationUnitType);
                string planeAngle                    = "Plane Angle: \t\t" + PlaneAngleUnit.GetUnitAsString(unitSystem.PlaneAngleUnitType);
                string volumeHeatTransferCoefficient = "Volume Heat Transfer Coeff.: \t" + VolumeHeatTransferCoefficientUnit.GetUnitAsString(unitSystem.VolumeHeatTransferCoefficientUnitType);

                this.TextBox.AppendText(temperature + "\r\n");
                this.TextBox.AppendText(pressure + "\r\n");
                this.TextBox.AppendText(massFlowRate + "\r\n");
                this.TextBox.AppendText(volumeFlowRate + "\r\n");
                this.TextBox.AppendText(moistureContent + "\r\n");
                this.TextBox.AppendText(relativeHumidity + "\r\n");
                this.TextBox.AppendText(enthalpy + "\r\n");
                this.TextBox.AppendText(specificHeat + "\r\n");
                this.TextBox.AppendText(energy + "\r\n");
                this.TextBox.AppendText(power + "\r\n");
                this.TextBox.AppendText(density + "\r\n");
                this.TextBox.AppendText(dynamicViscosity + "\r\n");
                this.TextBox.AppendText(kinematicViscosity + "\r\n");
                this.TextBox.AppendText(conductivity + "\r\n");
                this.TextBox.AppendText(diffusivity + "\r\n");
                this.TextBox.AppendText(mass + "\r\n");
                this.TextBox.AppendText(length + "\r\n");
                this.TextBox.AppendText(area + "\r\n");
                this.TextBox.AppendText(volume + "\r\n");
                this.TextBox.AppendText(time + "\r\n");
                this.TextBox.AppendText(smallLength + "\r\n");
                this.TextBox.AppendText(microLength + "\r\n");
                this.TextBox.AppendText(liquidHead + "\r\n");
                this.TextBox.AppendText(volumeRateFlowLiquids + "\r\n");
                this.TextBox.AppendText(volumeRateFlowGases + "\r\n");
                this.TextBox.AppendText(heatTransferCoeff + "\r\n");
                this.TextBox.AppendText(surfaceTension + "\r\n");
                this.TextBox.AppendText(velocity + "\r\n");
                this.TextBox.AppendText(foulingFactor + "\r\n");
                this.TextBox.AppendText(specificVolume + "\r\n");
                this.TextBox.AppendText(massVolumeConcentration + "\r\n");
                this.TextBox.AppendText(planeAngle + "\r\n");
                this.TextBox.AppendText(volumeHeatTransferCoefficient + "\r\n");

                this.textBoxUnitSystem.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            }
        }