Exemple #1
0
        public void vwBuildingOptions_SelectionChanged(int row)
        {
            if (_busyPaintingOptions)
            {
                return;
            }

            String        errMessage       = "";
            Decimal       optionsPrice     = 0;
            List <String> optionTypes      = new List <string>();
            List <String> validatedOptions = new List <string>();

            _order.ClearOptions();

            for (int i = 0; i < _screen.SelectedBuildingOptionsCount(); i++)
            {
                String[] screenOptions = _screen.GetBuildingOption(i);
                if (_screen.BuildingOptions_Selected(i))
                {
                    if (optionTypes.Contains(screenOptions[3]))
                    {
                        errMessage = String.Format("Only one type of {0} may be selected", screenOptions[3]);
                        _screen.SelectBuildingOption(i, false);
                        break;
                    }
                    else
                    {
                        validatedOptions.Add(screenOptions[0]);
                        optionTypes.Add(screenOptions[3]);
                        optionsPrice += Decimal.Parse(screenOptions[2]);

                        _order.AddOption(screenOptions[0]);
                    }
                }
            }

            _screen.OptionsPrice = optionsPrice.ToString();

            if (errMessage != "")
            {
                _screen.ShowMessage(errMessage);
            }

            RefreshPrice();
        }