Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Events

Events

Scheduled Pinned Locked Moved C#
csharpdesigntutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Monin D
    wrote on last edited by
    #1

    Hello, System.Net.WebClient has method: DownloadDataAsync and event:DownloadDataCompleted How does it internally work? So...I assume when I call DownloadDataAsync it starts some private method StartDownload (for example) in a new thread, and from this StartDowload(which runs in the Thread) will be called DownloadDataCompleted(), BUT they have made it so, that in attached to the event method, i can use all UI, thats mean...that DownloadDataCompleted is called in the main programm thread, how did they did that? Thanks.

    C S 2 Replies Last reply
    0
    • M Monin D

      Hello, System.Net.WebClient has method: DownloadDataAsync and event:DownloadDataCompleted How does it internally work? So...I assume when I call DownloadDataAsync it starts some private method StartDownload (for example) in a new thread, and from this StartDowload(which runs in the Thread) will be called DownloadDataCompleted(), BUT they have made it so, that in attached to the event method, i can use all UI, thats mean...that DownloadDataCompleted is called in the main programm thread, how did they did that? Thanks.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Delegates.

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      M 1 Reply Last reply
      0
      • C Christian Graus

        Delegates.

        Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

        M Offline
        M Offline
        Monin D
        wrote on last edited by
        #3

        Yes, but how? What should i invoke? So I mean, to invoke a UI control from Thread I should Invoke this control...but I want to be able OnEvent use all controls I want, without Invoking, like it did in System.Net.WebClient...is it possible? -- modified at 5:41 Wednesday 17th January, 2007

        1 Reply Last reply
        0
        • M Monin D

          Hello, System.Net.WebClient has method: DownloadDataAsync and event:DownloadDataCompleted How does it internally work? So...I assume when I call DownloadDataAsync it starts some private method StartDownload (for example) in a new thread, and from this StartDowload(which runs in the Thread) will be called DownloadDataCompleted(), BUT they have made it so, that in attached to the event method, i can use all UI, thats mean...that DownloadDataCompleted is called in the main programm thread, how did they did that? Thanks.

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          Have a look at the new AsyncOperationManager[^] class introduced in .NET 2.0.

          Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro

          M 1 Reply Last reply
          0
          • S S Senthil Kumar

            Have a look at the new AsyncOperationManager[^] class introduced in .NET 2.0.

            Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro

            M Offline
            M Offline
            Monin D
            wrote on last edited by
            #5

            Thanks! helped

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups