I'm using PDFSharp to develop an application. This library has a class called PdfReader wich has an Open Method and one argument of this method is an event delegate.
Private Sub PasswordProvider(ByVal args As PdfPasswordProviderArgs)
In this method you have to use args.Password to set the password of the pdf document you're trying to open.
I created a Window to ask for the password and after the window is closed I want to set the args.Password to the value typed by the user.
So i Have this code:
Private Sub PasswordProvider(ByVal args As PdfPasswordProviderArgs)
cObjWPassword = New AskPasswordWindow()
cObjWPassword.ShowDialog()
'This won't work, because thread keep running the code while the window is open
'args.Password = cObjWPassword.StrOwnerPwd
'Also tried to use the closed event
'Addhandler cObjWPassword.Closed, address of ....
'But with this approach I will not have acces to args parameter
end Sub
So what I would like to know is how can I set args.Password after the window is closed. The problem is that even though I'm using ShowDialog the execution thread keeps running. In the code I show the ways I have tried to solve this, but none of the options seem to work.
Can anybody help me to understand how can I solve this problem?
The application is built in VS2008, .net 3.5 and WPF.
Thanks