Пример #1
0
        private bool SaveLevelInDesigner()
        {
            bool returnMe         = false;
            FileSaveNameDialog sn = new FileSaveNameDialog();

            sn.SetName(Designer.GetName());

            while (true)
            {
                if (sn.ShowDialog() == DialogResult.OK) //if file doesn't exist or it's ok to overwrite
                {
                    string toFileName = sn.GetName();

                    if (toFileName.Length > 0 &&
                        (!Filer.LevelExists(toFileName) ||
                         MessageBox.Show("Overwite Level?",
                                         "Level file already exists.",
                                         MessageBoxButtons.YesNo) == DialogResult.Yes))
                    {
                        Filer.Save(toFileName, Designer);
                        returnMe = true;
                        MessageBox.Show("Level " + sn.GetName() + " saved successfully.");
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            sn.Dispose();
            return(returnMe);
        }