Example #1
0
        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();
        }
Example #2
0
 private Universe LoadUniverseFromUserSelectedFile(bool showDialog)
 {
     return(ShowOpenFileDialog(showDialog)
         ? UniverseHelper.GetFromFile(_openFileDialog.FileName, true)
         : _universe);
 }