/// <summary> /// Save the current simulation to file. /// </summary> private void Save() { // Get the current system from CPVM instance InterstellaSystem SystemToSave = CanvasPageViewModel.Instance.System; // If the system has no save name it has not been saved if (SystemToSave.SystemSaveName == "") { // If system has never been saved,Open New Enter Save Name Box OpenEnterSaveNameBox(); } else { bool FoundSystemFile = false; // If the system has a save name, attempt to find its save file by comparing against each avaliable save file foreach (var SaveFile in SystemFileParser.GetReadableSaveFiles()) { // Get the path the file would be saved as. string SystemToSaveFilePath = $"{SystemFileParser.ExecutingDomainFilePath}{SystemToSave.SystemSaveName}OSSaveFile.txt"; // If A save File is found. overwrite this file if (SaveFile == SystemToSaveFilePath) { SystemFileParser.OverWriteSystemFile(SystemToSave, SaveFile); FoundSystemFile = true; } } if (FoundSystemFile) { // If a save file has been found and saved to, return to main menu NavigateToMenu(); } else { // No save file found, must have been deleted or moved. // Ask for a new save name and save to a new file. OpenEnterSaveNameBox(); } } }
public CanvasSideBarViewModel(IEnumerable <InterstellaDragDropViewModel> dragDropObjects, InterstellaSystem system) { // Populate Drag Drop List DragDropVM = new DragDropListViewModel(dragDropObjects); InfoPannelVM = new InfoPannelViewModel(system); }
/// <summary> /// Display a given logical system to the canvaspage. /// </summary> /// <param name="system">Logical System to display</param> public void LoadSystem(InterstellaSystem system) { loadSystem(system); //UpdateSystemPannelObjects(); }