Example #1
0
        private void setClimate(TouristFirm.ClimateEnum climate)
        {
            /* Initializing variables */
            var c = new TouristFirm.ClimateEnum[5];

            c[0] = ClimateEnum.Tropical;
            c[1] = ClimateEnum.Dry;
            c[2] = ClimateEnum.Temperate;
            c[3] = ClimateEnum.Continental;
            c[4] = ClimateEnum.Polar;

            int i = 0;

            /* VarCheck */
            if (climate == ClimateEnum.ClimateNone)
            {
                return;
            }

            /* Main part */
            foreach (var clim in c)
            {
                if (clim == climate)
                {
                    break;
                }

                ++i;
            }

            comboBoxClimate.SelectedItem = comboBoxClimate.Items[i];
        }
Example #2
0
        private TouristFirm.ClimateEnum getClimate()
        {
            /* Initializing variables */
            var c = new TouristFirm.ClimateEnum[5];

            c[0] = ClimateEnum.Tropical;
            c[1] = ClimateEnum.Dry;
            c[2] = ClimateEnum.Temperate;
            c[3] = ClimateEnum.Continental;
            c[4] = ClimateEnum.Polar;

            int index = comboBoxClimate.SelectedIndex;

            /* Returning value */
            return((index > 4 || index < 0) ? ClimateEnum.ClimateNone : c[comboBoxClimate.SelectedIndex]);
        }