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. creating dialogs

creating dialogs

Scheduled Pinned Locked Moved C#
4 Posts 2 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
    Manu_81
    wrote on last edited by
    #1

    Hi, In my WinForm App, I have a blocking call to dll that takes a while to return. I want to indicate the user to wait, probably by showing an animated gif or progress bar. I dont want to go into threading. Is there any other way to do this. I created another form that looks like small dialog with the animated gif and text box.I changed the FormBorderStyle property to FixedDialog. I called it from my form as WaitDialog WaitD = new WaitDialog(this); WaitD.Show(); ////blocking call to DLL... WaitD.Dispose(); What happens is, it shows the wait form, but none of its controls ( the animated gif and text box) is shown. I get a blank white boxes in their places. What should I do. Any ideas. Thanks in advance. -- modified at 15:10 Tuesday 28th February, 2006

    J 1 Reply Last reply
    0
    • M Manu_81

      Hi, In my WinForm App, I have a blocking call to dll that takes a while to return. I want to indicate the user to wait, probably by showing an animated gif or progress bar. I dont want to go into threading. Is there any other way to do this. I created another form that looks like small dialog with the animated gif and text box.I changed the FormBorderStyle property to FixedDialog. I called it from my form as WaitDialog WaitD = new WaitDialog(this); WaitD.Show(); ////blocking call to DLL... WaitD.Dispose(); What happens is, it shows the wait form, but none of its controls ( the animated gif and text box) is shown. I get a blank white boxes in their places. What should I do. Any ideas. Thanks in advance. -- modified at 15:10 Tuesday 28th February, 2006

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Manu_81 wrote:

      a while to return. I want t

      A blocking call is a blocking call, there's really no way around this. Once your UI thread makes the blocking call to your dll, you're stuck in that you cannot update your form. You *could* pass your form instance into the blocking call, and have the blocking call call form.Update or Application.DoEvents(), but that's sounding more like a hack than anything. What's wrong with threading for this?

      M 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Manu_81 wrote:

        a while to return. I want t

        A blocking call is a blocking call, there's really no way around this. Once your UI thread makes the blocking call to your dll, you're stuck in that you cannot update your form. You *could* pass your form instance into the blocking call, and have the blocking call call form.Update or Application.DoEvents(), but that's sounding more like a hack than anything. What's wrong with threading for this?

        M Offline
        M Offline
        Manu_81
        wrote on last edited by
        #3

        Apart from the blocking call, I also call various other functions from the dll and display the return results to the user. So if I do thread, that would be like updating the UI inside this thread, which I dont want to do. I also want to avoid thread for this, as my app uses some threads in different places. I just dont want to use so many threads in my app... So there is no way to get around this??? -- modified at 15:49 Tuesday 28th February, 2006

        J 1 Reply Last reply
        0
        • M Manu_81

          Apart from the blocking call, I also call various other functions from the dll and display the return results to the user. So if I do thread, that would be like updating the UI inside this thread, which I dont want to do. I also want to avoid thread for this, as my app uses some threads in different places. I just dont want to use so many threads in my app... So there is no way to get around this??? -- modified at 15:49 Tuesday 28th February, 2006

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          Manu_81 wrote:

          I just dont want to use so many threads in my app...

          Threads are a good thing. They allow you to utilize multi-core and multi-processor machines far more than a single-threaded application would. They also keep your UI thread responsive, which end-users will praise you for. I recommend that your DLL do its heavy lifting on another thread. While that thread is running, have the dll just display a "loading..." or "please wait..." dialog of some kind. Then, when the thread is finished, return the results to the UI thread for display to the user. You can use the BackgroundWorker[^] class to help you do this in a simple manner. The only other option would be to make a call to .Update() your form from your dll or call Application.DoEvents. However, there are caveats and gotchas associated with those solutions; the best solution is to do heavy lifting on a background thread.

          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