I have created a small program that registers a hotkey, and when the hotkey is pressed, it takes a screenshot of the screen.
Now after this screenshot is taken, I want it to upload.
I have the following code:
vb.net Code:
If mftp.Login() Then
mftp.ChangeDirectory(My.Settings.ftpdirectory)
mftp.UploadFile(IO.Path.Combine(filelocationtextbox.Text, filename) & ".jpg")
Else
lg.Log("FTP Login Failed: ->" & Date.Now)
displayMessage("FTP Login Failed")
_isBusy = False
End If
As you can see,
as soon as someone presses the hotkey, it puts _isbusy to true. That way i can prevent IO exceptions by only running the code when the current file is saved.
But uploading is a different story. I dont want the _isbusy to be true while its uploading right.. so what would i need if I wanted to implement the following:
UI thread:
Code:
hotkey register,
isbusy = true
screenshot taken
screenshot saved to disk
ADD SS to a LIST TO BE UPLOADED
isbusy = false
BG Thread:
Code:
if list of uploaded files is not empty, then upload the current file and remove it from the list.
if the person presses the hotkey again it should add it to the list.
Edit: It seems liek I need the Threadpool class so I've read about it on MSDN (link: http://msdn.microsoft.com/en-us/libr...readpool.aspx). However, how should I create a "list".