Jump to content

OnSave Cancel?


aaro4130
 Share

Recommended Posts

Hey! Is there a way to cancel the OnSave method so it doesn't write a null file?

 

Or is there any other way to do this

 

 

Dim SD As New SaveDialog
SD.ShowDialog
If SD.DialogResult = Ok Then
LOG("Save the image")
Else
LOG("Cancelled but writes null file")
LOG("Any way to stop that?")
End if

 

Before OnSave?

 

Here is my save dialog btw

nedKMq7.png

Edited by aaro4130
Link to comment
Share on other sites

You cannot cancel OnSave(). The user has told Paint.NET to save the image, and it's the plugin's job to either save or die trying. You don't get to cancel for the user.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Why are you creating your own Save dialog?

 

This is completely outside the bounds of what's supported/allowed, and you won't be able to publish your plugin here on the forum.

 

The correct way to do this is to use the mechanism that's already provided for doing a Save Configuration UI. You should NOT be showing UI during OnSave, that's just completely backwards.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Yeah there's nooooooo need to build your own dialog.

 

Either override the virtual method "CreateSaveConfigWidget()", or derive from PropertyBasedFileType. The latter, which uses something called IndirectUI, is much easier way to create UI for this type of stuff.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...