private void buttonEditIndividualSighting_Click(object sender, EventArgs e) { tce = new SightingEditor(Session, this.Individual, (IndividualSighting)individualSightingBindingSource.Current); tce.ShowDialog(); dataGridViewIndividualSighting.Refresh(); }
private void buttonNew_Click(object sender, EventArgs e) { tce = new SightingEditor(Session, this.Individual); DialogResult result = tce.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { this.Individual.SightingHistory.Add(tce.State); this.individualSightingBindingSource.Add(tce.State); this.RefreshLabels(); } }
protected override void RowAction(DataGridViewRow row) { Individual individual = currentStates[row.Index].Individual; IndividualSighting tc = null; // We are making an entry for a specific date if (troopVisit != null) { tc = new IndividualSighting(); tc.Individual = individual; tc.TroopVisit = troopVisit; } SightingEditor tce = new SightingEditor(Session, individual, tc); if (tce.ShowDialog() == System.Windows.Forms.DialogResult.OK) { individual.SightingHistory.Add(tce.State); RefreshRow(row); } }
void SetCurrentTroopLabel() { Troop currentTroop = Individual.CurrentTroop(); if (currentTroop == null) { // Set a blank label this.labelCurrentTroop.Text = "No Troop"; /// INTEGRITY CHECK // No current troop so we need to ask for a new entry bool askForTroopInfo = false; if (askForTroopInfo) { DialogResult result = MessageBox.Show("There is no current troop information for " + Individual.Name + ". Click Ok to add an entry, or cancel to leave blank for now.", "No current troop", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.OK) { // Create individual sighting entry tce = new SightingEditor(Session, this.Individual); DialogResult tceResult = tce.ShowDialog(); if (tceResult == System.Windows.Forms.DialogResult.OK) { Individual.SightingHistory.Add(tce.State); SetCurrentTroopLabel(); } } } } else { this.labelCurrentTroop.Text = currentTroop.TroopID; } }