コード例 #1
0
        public TutorialPage(TutorialItem ti)
        {
            tutorial = ti;

            InitializeComponent();

            gridControl1.GenerationChanged += new EventHandler(gridControl1_GenerationChanged);
            gridControl1.AllowDrawing       = false;
        }
コード例 #2
0
        private void TutorialMain_Load(object sender, EventArgs e)
        {
            checkBoxTutorial.Checked = LearnLifeWin.Properties.Settings.Default.ShowTutorial;

            string tutorialXmlFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Tutorial", "tutorial.xml");

            using (XmlReader reader = XmlReader.Create(tutorialXmlFile))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        if (reader.Name == "tutorial")
                        {
                            TutorialItem ti = new TutorialItem(reader["name"], reader["pattern"], reader["file"]);
                            while (reader.MoveToNextAttribute())
                            {
                                if (reader.Name == "generationmax")
                                {
                                    ti.GenerationMax = reader.ReadContentAsInt();
                                }
                                if (reader.Name == "border")
                                {
                                    ti.Border = reader.ReadContentAsInt();
                                }
                            }
                            listBox1.Items.Add(ti);
                        }
                    }
                }

                listBox1.DisplayMember = "name";
                listBox1.ValueMember   = "name";
                listBox1.SelectedIndex = 0;
            }
        }