コード例 #1
0
        public void onSave(object obj, EventArgs e)
        {
            play.Enabled  = true;
            pause.Enabled = false;


            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter       = "Crazy files (*.crazy)|*.crazy";
            dialog.DefaultExt   = "crazy*";
            dialog.AddExtension = true;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    model.saveGame(dialog.FileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Cannot save game!" + Environment.NewLine + "Wrong path or have no write right!.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                MessageBox.Show("Successfull save!");
            }
        }