コード例 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            XDocument xDoc = XDocument.Load(Turn.SavePath);

            if (bool.Parse(xDoc.XPathSelectElement("Turn/IsStartOfTurn").Value))
            {
                CampaignForm cf = new CampaignForm();
                this.Hide();
                cf.ShowDialog();
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Can't edit campaign in the middle of a turn");
            }
        }
コード例 #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            XDocument playerDoc = XDocument.Load(Player.SavePath);
            XDocument turnDoc = XDocument.Load(Turn.SavePath);

            if (turnDoc.XPathSelectElements("Turn").Nodes().Count() > 0)
            {
                if (MessageBox.Show("About to delete any existing campaign. Are you sure?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }

            playerDoc.XPathSelectElements("Players").Nodes().Remove();
            playerDoc.Save(Player.SavePath);

            turnDoc.XPathSelectElements("Turn").Nodes().Remove();
            turnDoc.Save(Turn.SavePath);

            CampaignForm mf = new CampaignForm();
            this.Hide();
            mf.ShowDialog();
            this.Dispose();
        }
コード例 #3
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     CampaignForm cf = new CampaignForm();
     this.Hide();
     cf.ShowDialog();
     this.Dispose();
 }