コード例 #1
0
        // highlights a row of records and displays the details
        private void tablePreviousBounties_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                // gets a collection that contains all the rows
                DataGridViewRow row = this.tablePreviousBounties.Rows[e.RowIndex];

                Bounty comparator = (Bounty)row.Cells[5].Value;
                textBoxPreviousBounty.Text = comparator.ToString();
                label1.Text = "Details of Bounty " + comparator.ID + ":";
            }
        }
コード例 #2
0
        //add the last generated bounty to the record list
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (generatedBounty != null)
            {
                textBoxReadout.Text = "";
                object[] rowToAdd = { generatedBounty.ID,                            generatedBounty.location, generatedBounty.riskLevel, generatedBounty.numberOfTargets,
                                      generatedBounty.reward.ToString("N0") + " cR", generatedBounty };

                tablePreviousBounties.Rows.Insert(0, rowToAdd);
                tablePreviousBounties.AutoResizeColumns();
                tablePreviousBounties.Rows[0].Selected = true;
                Bounty selected = (Bounty)tablePreviousBounties[5, 0].Value;
                textBoxPreviousBounty.Text = selected.ToString();
                label1.Text = "Details of Bounty " + selected.ID + ":";
            }
        }
コード例 #3
0
        //creates a new bounty with entirley random parameters
        private void buttonRandom_Click(object sender, EventArgs e)
        {
            globalCounter += 1;
            double coinFlip = seed.NextDouble();
            bool   outcome;

            if (coinFlip >= 0.50)
            {
                outcome = true;
            }
            else
            {
                outcome = false;
            }

            generatedBounty     = new Bounty(globalCounter, seed.Next(1, 4), seed.Next(1, 7), partyMembers, outcome);
            textBoxReadout.Text = generatedBounty.ToString();
        }
コード例 #4
0
 //create a new bounty
 private void buttonGenerate_Click(object sender, EventArgs e)
 {
     globalCounter      += 1;
     generatedBounty     = new Bounty(globalCounter, riskLevel, numberOfTargets, partyMembers, specialConditions);
     textBoxReadout.Text = generatedBounty.ToString();
 }