private Encounter GetEncounter(bool edit) { try { var source = _database.GetAll(); if (!source.Any()) { throw new Exception("No Encounters To Show"); } var form = new LoadEncounterForm(edit) { Source = _database }; while (true) { //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return(null); } if (form.Encounter != null) { return(form.Encounter); } else if (form.Encounter == null && result != DialogResult.Cancel) { MessageBox.Show("No Encounter Selected"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
private Encounter GetEncounter(string title) { try { var form = new LoadEncounterForm() { Text = title, Source = _database }; //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return(null); } return(form.Encounter); }catch { return(null); } }