Results 1 to 2 of 2

Thread: [RESOLVED] [2008] Uploading + Multithreading.

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    607

    Resolved [RESOLVED] [2008] Uploading + Multithreading.

    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:
    1. If mftp.Login() Then
    2.      mftp.ChangeDirectory(My.Settings.ftpdirectory)
    3.      mftp.UploadFile(IO.Path.Combine(filelocationtextbox.Text, filename) & ".jpg")                          
    4.                            
    5. Else
    6.      lg.Log("FTP Login Failed: ->" & Date.Now)
    7.      displayMessage("FTP Login Failed")
    8.      _isBusy = False
    9. 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".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width