private void LoadUniverse(bool showDialogs = true) { var selectedUniverse = selectStartUniverse.SelectedItem.ToString(); _universe = selectedUniverse switch { EmptyUniverse => new Universe(), RandomUniverse => LoadRandomUniverse(showDialogs), OpenFile => LoadUniverseFromUserSelectedFile(showDialogs), _ => UniverseHelper.GetFromFile(selectedUniverse) }; SaveToHistory(); CenterUniverse(); _generations = 0; UpdateCounters(); }
private Universe LoadUniverseFromUserSelectedFile(bool showDialog) { return(ShowOpenFileDialog(showDialog) ? UniverseHelper.GetFromFile(_openFileDialog.FileName, true) : _universe); }