Saving Canvas

After I create my diagram on the Canvas, I have to save it, but let’s say I click the ‘New Canvas’ button without saving my diagram, I lose all my work.

My Question is, Is there a way to have a Prompt that says 'You have not Saved your work, you sure you want to continue' with a Yes or Cancel buttons on it? Are there any examples of this? How would i create this? My diagram is set up like the Processor example.
Thank you

GoDocument.IsModified will tell you if the document has changes to save.

Demo1, FlowCharter and OrgCharter all have samples of what you want to do.