コード例 #1
0
 public Main()
 {
     InitializeComponent();
     if (!File.Exists(NameXml))
     {
         NameXml = null;
         Game    = new Mines(0);
     }
     else
     {
         Game = new Mines(0, NameXml);
     }
     gph = panel1.CreateGraphics();
     appLog.Write("[START]");
     UpdateForm();
 }
コード例 #2
0
 private void новичокToolStripMenuItem_Click(object sender, EventArgs e)
 {
     новичокToolStripMenuItem.Checked      = true;
     профессионалToolStripMenuItem.Checked = false;
     экспертToolStripMenuItem.Checked      = false;
     if (NameXml == null)
     {
         Game = new Mines(0);
     }
     else
     {
         Game = new Mines(0, NameXml);
     }
     gph.Clear(Color.White);
     timer.Stop();
     UpdateForm();
 }
コード例 #3
0
 private void изменитьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (openFileDialog1.ShowDialog() == DialogResult.OK)
         {
             Valid = true;
             XmlReaderSettings gameSettings = new XmlReaderSettings();
             gameSettings.Schemas.Add(null, "table.xsd");
             gameSettings.ValidationType          = ValidationType.Schema;
             gameSettings.ValidationEventHandler += new ValidationEventHandler(gameSettingsValidationEventHandler);
             XmlReader games = XmlReader.Create(openFileDialog1.FileName, gameSettings);
             while (games.Read())
             {
             }
             if (!Valid)
             {
                 NameXml = null;
                 Game    = new Mines(0);
                 gph.Clear(Color.White);
                 timer.Stop();
                 throw new Exception();
             }
             else
             {
                 NameXml = openFileDialog1.FileName;
                 Game    = new Mines(0, NameXml);
                 gph.Clear(Color.White);
                 timer.Stop();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Выбран неверный файл");
         appLog.Write(ex.Message);
     }
     finally
     {
         UpdateForm();
     }
 }
コード例 #4
0
 private void новаяИграToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (NameXml != null)
     {
         if (новичокToolStripMenuItem.Checked)
         {
             Game = new Mines(0, NameXml);
         }
         else
         if (профессионалToolStripMenuItem.Checked)
         {
             Game = new Mines(2, NameXml);
         }
         else if (экспертToolStripMenuItem.Checked)
         {
             Game = new Mines(1, NameXml);
         }
     }
     else
     {
         if (новичокToolStripMenuItem.Checked)
         {
             Game = new Mines(0);
         }
         else
         if (профессионалToolStripMenuItem.Checked)
         {
             Game = new Mines(2);
         }
         else if (экспертToolStripMenuItem.Checked)
         {
             Game = new Mines(1);
         }
     }
     gph.Clear(Color.White);
     ShowField(gph);
     UpdateForm();
 }