Example #1
0
        public ICommand CreateCommand()
        {
            ICommand ret = null;
            // bool add = false;
            // add = true;
            string title = "Add Spawn Generator to Region";

            using (AddMobDialog dlg = new AddMobDialog(title, false))
            {
                dlg.RespawnTimeTextboxText    = app.Config.MobRespawnTimeDefault.ToString();
                dlg.NumberOfSpawnsTextboxText = app.Config.MobNumSpawnDefault.ToString();
                dlg.TemplateNameTextBoxText   = "";
                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 AddSpawnGenToRegionCommand(app, parent, dlg.RespawnTime, dlg.NumberOfSpawns, dlg.TemplateNameTextBoxText);
                }
                return(ret);
            }
        }
        public ICommand CreateCommand()
        {
            ICommand ret = null;
            // bool add = false;
            // add = true;
            string title = "Add Spawn Generator to Region";

            using (AddMobDialog dlg = new AddMobDialog(title, false))
            {
                dlg.RespawnTimeTextboxText = app.Config.MobRespawnTimeDefault.ToString();
                dlg.NumberOfSpawnsTextboxText = app.Config.MobNumSpawnDefault.ToString();
                dlg.TemplateNameTextBoxText = "";
                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 AddSpawnGenToRegionCommand(app, parent, dlg.RespawnTime, dlg.NumberOfSpawns, dlg.TemplateNameTextBoxText);
                }
                return ret;
            }
        }