private void HandleSave() { if (string.IsNullOrEmpty(window.FileName)) { //go to save as window.GoSaveAs(); if (string.IsNullOrEmpty(window.FileName)) { cancelSave = true; return; } } if (model.Changed) { File.Delete(window.FileName); //save spreadsheet model.Save(File.CreateText(window.FileName)); } }