public ICommand CreateCommand()
        {
            ICommand         ret       = null;
            List <AssetDesc> assetList = app.Assets.Select("Vegitation");
            string           title;

            // bool add = false; (unused)

            // add = true;
            title = "Add A PlantType";

            using (AddPlantTypeDialog dlg = new AddPlantTypeDialog(title, assetList, app))
            {
                dlg.Instances          = app.Config.InstancesDefault;
                dlg.MinimumWidthScale  = app.Config.ScaleWidthLowDefault;
                dlg.MaximumWidthScale  = app.Config.ScaleWidthHiDefault;
                dlg.MinimumHeightScale = app.Config.ScaleHeightLowDefault;
                dlg.MaximumHeightScale = app.Config.ScaleHeightHiDefault;
                dlg.ColorMultLow       = app.Config.ColorMultLowDefault;
                dlg.ColorMultHi        = app.Config.ColorMultHiDefault;
                dlg.WindMagnitude      = app.Config.WindMagnitudeDefault;

                bool         showAgain = false;
                DialogResult result;
                do
                {
                    result    = dlg.ShowDialog();
                    showAgain = false;
                    if (result == DialogResult.OK)
                    {
                        // do validation here
                        // if validation fails, set showAgain to true
                        showAgain = ((result == DialogResult.OK) && (!dlg.okButton_validating()));
                    }
                } while (showAgain);
                if (result == DialogResult.OK)
                {
                    ret = new AddPlantTypeCommand(app, parent, dlg.Instances, dlg.ComboBoxSelected, app.Assets.assetFromName(dlg.ComboBoxSelected).AssetName, dlg.MaximumWidthScale, dlg.MinimumWidthScale, dlg.MaximumHeightScale, dlg.MinimumHeightScale, dlg.ColorRGB, dlg.ColorMultHi, dlg.ColorMultLow, dlg.WindMagnitude);
                }
            }
            return(ret);
        }
コード例 #2
0
        public ICommand CreateCommand()
        {
            ICommand ret = null;
            List<AssetDesc> assetList = app.Assets.Select("Vegitation");
            string title;
            // bool add = false; (unused)

            // add = true;
            title = "Add A PlantType";

            using (AddPlantTypeDialog dlg = new AddPlantTypeDialog(title, assetList, app))
            {
                dlg.Instances = app.Config.InstancesDefault;
                dlg.MinimumWidthScale = app.Config.ScaleWidthLowDefault;
                dlg.MaximumWidthScale = app.Config.ScaleWidthHiDefault;
                dlg.MinimumHeightScale = app.Config.ScaleHeightLowDefault;
                dlg.MaximumHeightScale = app.Config.ScaleHeightHiDefault;
                dlg.ColorMultLow = app.Config.ColorMultLowDefault;
                dlg.ColorMultHi = app.Config.ColorMultHiDefault;
                dlg.WindMagnitude = app.Config.WindMagnitudeDefault;

                bool showAgain = false;
                DialogResult result;
                do {
                    result = dlg.ShowDialog();
                    showAgain = false;
                    if ( result == DialogResult.OK) {
                        // do validation here
                        // if validation fails, set showAgain to true
                        showAgain = ((result == DialogResult.OK) && (!dlg.okButton_validating()));
                    }

                } while (showAgain);
                if (result == DialogResult.OK)
                {
                    ret = new AddPlantTypeCommand(app, parent, dlg.Instances, dlg.ComboBoxSelected, app.Assets.assetFromName(dlg.ComboBoxSelected).AssetName, dlg.MaximumWidthScale, dlg.MinimumWidthScale, dlg.MaximumHeightScale, dlg.MinimumHeightScale, dlg.ColorRGB, dlg.ColorMultHi, dlg.ColorMultLow, dlg.WindMagnitude);
                }
            }
            return ret;
        }