public ICommand CreateCommand()
        {
            ICommand ret = null;
            // bool add = false; (unused)
            // add = true;
            string title = "Add Spawn Generator to Marker";

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

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