示例#1
0
文件: Form1.cs 项目: Flash4433/BEE2.2
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool nameisgood;

            //prompt for name
            do
            {
                nameisgood = true;
                if (aPromtForm == null)
                {
                    aPromtForm = new PromtForm("Palette Name", "", "Cancel", "Save Palette");
                }
                aPromtForm.ShowDialog(this);
                if (aPromtForm.SafeData)
                {
                    foreach (object palette in Global.ListOfPalettes)
                    {
                        if (((PaletteLayout)palette).Name.Trim() == aPromtForm.ReturnValue.Trim())
                        {
                            nameisgood = false;
                            MessageBox.Show("That name is already taken, try something else", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    break;
                }
            } while (!nameisgood);
            if (aPromtForm.SafeData)
            {
                string name = aPromtForm.ReturnValue;

                //make sure a palette with that name doesn't already exist

                Global.SavePalette(name, name, panelItemHolderPalette.PuzzleItems.ToList());
                Global.LoadPalettes();
                paletteLayoutComboBox.Items.Clear();
                foreach (object palette in Global.ListOfPalettes)
                {
                    paletteLayoutComboBox.Items.Add(((PaletteLayout)palette).Name);
                }
                paletteLayoutComboBox.Text = name;
            }
        }
示例#2
0
文件: Form1.cs 项目: BenVlodgi/BEE2
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool nameisgood;
            //prompt for name 
            do
            {
                nameisgood = true;
                if (aPromtForm == null)
                    aPromtForm = new PromtForm("Palette Name", "", "Cancel", "Save Palette");
                aPromtForm.ShowDialog(this);
                if (aPromtForm.SafeData)
                {
                    foreach (object palette in Global.ListOfPalettes)
                    {
                        if (((PaletteLayout)palette).Name.Trim() == aPromtForm.ReturnValue.Trim())
                        {
                            nameisgood = false;
                            MessageBox.Show("That name is already taken, try something else", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                    break;

            } while (!nameisgood);
            if (aPromtForm.SafeData)
            {
                string name = aPromtForm.ReturnValue;

                //make sure a palette with that name doesn't already exist

                Global.SavePalette(name, name, panelItemHolderPalette.PuzzleItems.ToList());
                Global.LoadPalettes();
                paletteLayoutComboBox.Items.Clear();
                foreach (object palette in Global.ListOfPalettes)
                {
                    paletteLayoutComboBox.Items.Add(((PaletteLayout)palette).Name);
                }
                paletteLayoutComboBox.Text = name;
            }

        }