Anyway, like other document-based applications, .NETpad lets the user save a document (“Save”) or save a document using a different file name (“Save As”). But it’s a little more nuanced then that: If you’re working with a new, as-yet-unsaved document and you choose to save it, you’re really doing a Save As in that one instance; subsequent saves will call Save instead.
WPF provides support for Save and SaveAs commands. But because we will need to use the functionality from either in other contexts, we’ll create our own Save and SaveAs methods and then call them from SaveCommand_Executed and SaveAsCommand_Executed. (And later, from elsewhere too.)