aaro4130 Posted August 23, 2013 Posted August 23, 2013 (edited) 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 Edited August 23, 2013 by aaro4130 Quote
Rick Brewster Posted August 23, 2013 Posted August 23, 2013 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. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
aaro4130 Posted August 23, 2013 Author Posted August 23, 2013 So where can I put the code to show the dialog instead? So the user can cancel this. Quote
Rick Brewster Posted August 23, 2013 Posted August 23, 2013 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. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
aaro4130 Posted August 23, 2013 Author Posted August 23, 2013 (edited) Could you give me a hand on using the built in UI? I had no clue this type was not allowed. Is there any tutorial around? Edited August 23, 2013 by aaro4130 Quote
Rick Brewster Posted August 23, 2013 Posted August 23, 2013 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 a much easier way to create UI for this type of stuff. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.