private void btn_NewFromTemplate_Click(object sender, EventArgs e) { List <string> templateNames = objectTemplates.Keys.ToList(); SelectTemplateWindow selectTemplate = new SelectTemplateWindow(templateNames); selectTemplate.Closed += delegate { switch (selectTemplate.DialogResult) { case DialogResult.OK: NewGameObject newGameObject = new NewGameObject(Observer); newGameObject.Closed += delegate { switch (newGameObject.ValidObject) { case true: GameObject gameObject = objectTemplates[selectTemplate.SelectedTemplate].CloneGameObject(); gameObject.Name = newGameObject.ReturnGameObject.Name; AddGameObjectToDisplay(gameObject); Observer.ObserveGameObject(gameObject); return; case false: return; } }; newGameObject.ShowDialog(); break; case DialogResult.Cancel: return; } }; selectTemplate.ShowDialog(); }
private void btn_NewGameObject_Click(object sender, EventArgs e) { NewGameObject newObjectForm = new NewGameObject(Observer); newObjectForm.Closed += delegate(object o, EventArgs args) { if (newObjectForm.ValidObject) { AddGameObjectToDisplay(newObjectForm.ReturnGameObject); } }; newObjectForm.ShowDialog(); }
private void btn_NewTemplate_Click(object sender, EventArgs e) { NewGameObject newGameObject = new NewGameObject(Observer); newGameObject.ShowDialog(); switch (newGameObject.ValidObject) { case true: Response response = SaveTemplate(newGameObject.ReturnGameObject); if (!response.ValidData) { return; } Observer.ObserveGameObject(newGameObject.ReturnGameObject); listBox_Templates.Items.Add(newGameObject.ReturnGameObject.Name); currentTemplates.Add(newGameObject.ReturnGameObject.Name,newGameObject.ReturnGameObject); return; case false: return; } }
private void btn_NewTemplate_Click(object sender, EventArgs e) { NewGameObject newGameObject = new NewGameObject(Observer); newGameObject.ShowDialog(); switch (newGameObject.ValidObject) { case true: Response response = SaveTemplate(newGameObject.ReturnGameObject); if (!response.ValidData) { return; } Observer.ObserveGameObject(newGameObject.ReturnGameObject); listBox_Templates.Items.Add(newGameObject.ReturnGameObject.Name); currentTemplates.Add(newGameObject.ReturnGameObject.Name, newGameObject.ReturnGameObject); return; case false: return; } }
private void btn_NewFromTemplate_Click(object sender, EventArgs e) { List<string> templateNames = objectTemplates.Keys.ToList(); SelectTemplateWindow selectTemplate = new SelectTemplateWindow(templateNames); selectTemplate.Closed += delegate { switch (selectTemplate.DialogResult) { case DialogResult.OK: NewGameObject newGameObject = new NewGameObject(Observer); newGameObject.Closed += delegate { switch (newGameObject.ValidObject) { case true: GameObject gameObject = objectTemplates[selectTemplate.SelectedTemplate].CloneGameObject(); gameObject.Name = newGameObject.ReturnGameObject.Name; AddGameObjectToDisplay(gameObject); Observer.ObserveGameObject(gameObject); return; case false: return; } }; newGameObject.ShowDialog(); break; case DialogResult.Cancel: return; } }; selectTemplate.ShowDialog(); }