Пример #1
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "XML Files|*.xml";
            openFileDialog1.Title  = "Select an XML File";

            // Show the Dialog.
            // If the user clicked OK in the dialog and
            // a .CUR file was selected, open it.
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                System.Xml.Serialization.XmlSerializer reader = new XmlSerializer(typeof(Xml));

                // Read the XML file.
                // StreamReader file = new StreamReader(openFileDialog1.FileName);
                string fileName = openFileDialog1.FileName;

//                // Deserialize the content of the file into a Book object.
//              xproject = (Xml)reader.Deserialize(file);

                //              file.Close();
                outputWindow.Text = "";
                game = Game.GetInstance();
                game.SetOutputWindow(outputWindow);
                game.SetGameData(fileName);
                game.Run();
                outputWindow.SelectionStart = outputWindow.Text.Length;
            }
        }