Ejemplo n.º 1
0
        public void NewMaterial()
        {
            NameDialog    nameDialog = new NameDialog();
            RewriteDialog rewrite    = new RewriteDialog();
            DialogResult  rewriteResult;

            if (nameDialog.ShowDialog() == DialogResult.OK)
            {
                if (Material.floor.ContainsKey(nameDialog.textBox.Text))
                {
                    do
                    {
                        rewriteResult = rewrite.ShowDialog();
                        if (rewriteResult == DialogResult.OK)
                        {
                            Material.floor.Remove(nameDialog.textBox.Text);
                            Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text));
                            break;
                        }
                        else if (rewriteResult == DialogResult.Retry)
                        {
                            nameDialog.ShowDialog();
                        }
                        else if (rewriteResult == DialogResult.Cancel)
                        {
                            break;
                        }
                    } while (Material.floor.ContainsKey(nameDialog.textBox.Text));
                    if (rewriteResult == DialogResult.Retry)
                    {
                        Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text));
                    }
                }
                else
                {
                    Material.floor.Add(nameDialog.textBox.Text, materialEditPreview.CreateMaterial(nameDialog.textBox.Text));
                }
            }
            nameDialog.Dispose();
            rewrite.Dispose();
        }