Exemplo n.º 1
0
        // Method for selecting and loading an existing player for
        // view or editing.
        private void GetSelectedPlayer(DataRowView row)
        {
            // Cancel method if blank space is selected.
            if (row == null)
            {
                return;
            }

            // Create player object from selected row.
            Player player = new Player();

            player.Id          = row.Row.Field <int>("Id");
            player.CampaignId  = row.Row.Field <int>("CampaignId");
            player.Name        = row.Row.Field <string>("Name");
            player.Size        = row.Row.Field <string>("Size");
            player.Allignment  = row.Row.Field <string>("Alignment");
            player.Description = row.Row.Field <string>("Description");
            player.Tag         = row.Row.Field <string>("Tag");
            player.Level       = row.Row.Field <int>("Level");
            player.StartDate   = row.Row.Field <DateTime>("StartDate");
            player.Race        = row.Row.Field <string>("Race");
            player.Class       = row.Row.Field <string>("Class");

            // Create a player form with loaded data and display it.
            FormPlayer formPlayer = new FormPlayer(this, player);

            formPlayer.Show();
        }
Exemplo n.º 2
0
        private void toolStripButtonNewPlayer_Click(object sender, EventArgs e)
        {
            // Create a new, blank player form and display it.
            FormPlayer formPlayer = new FormPlayer(this);

            formPlayer.Show();
        }