• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

.net Ipc Vs2005

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    .net Ipc Vs2005

    To make life easier for one my developers I am looking for a windows control which I can use for IPC to the UI thread.

    All I want to do is pass an object from one thread and have an event fire in a UI thread. It's making my head hurt thinking how I can achieve this. Any suggestions ?

    It's just a load easier for him to drop a control on his form and handle the events rather than have to worry about updating the UI from different threads.

    Cheers.

    #2
    Have you tried Control.Invoke?
    Where are we going? And what’s with this hand basket?

    Comment


      #3
      Originally posted by voodooflux View Post
      Have you tried Control.Invoke?
      Naturally he can do that, but it's a bit of a pain for him to do it - though he may well have to [though it will take a fair bit of explaining the techniques he's going to need to use]. I think http://msdn.microsoft.com/en-us/libr...oncontext.aspx might help, but I've got a fair bit of reading up to do.

      I could write a control that exposes the methods I want my thread to call and this queues them and dequeues them on a (form) timer or similar.

      Basically al I want to end up with is in my thread SomeObject.PostMessage(object) and then in his UI Event MessageReceived(someData as object).

      It seems as though there should be some control available which will help me with this, but stuffed if I can find one....

      Comment


        #4
        Is this any help?

        http://www.codeproject.com/KB/thread...splay=PrintAll

        Comment


          #5
          Originally posted by ASB View Post
          Naturally he can do that, but it's a bit of a pain for him to do it - though he may well have to [though it will take a fair bit of explaining the techniques he's going to need to use]. I think http://msdn.microsoft.com/en-us/libr...oncontext.aspx might help, but I've got a fair bit of reading up to do.

          I could write a control that exposes the methods I want my thread to call and this queues them and dequeues them on a (form) timer or similar.

          Basically al I want to end up with is in my thread SomeObject.PostMessage(object) and then in his UI Event MessageReceived(someData as object).

          It seems as though there should be some control available which will help me with this, but stuffed if I can find one....
          From what you've said (and apologies if I've misunderstood) I still think Control.Invoke is what you want here - although you may wish to hide the implementation from your developer by wrapping the functionality in something more "friendly". Assuming I have understood correctly, Control.Invoke is provided for the exact scenario you describe.
          Where are we going? And what’s with this hand basket?

          Comment


            #6
            Originally posted by DimPrawn View Post
            Hmm, I think that should pretty much do it. I need to review it and wrap it all up in a class I provide. Only issue I have is trying to hide it from my new developer as much as possible.

            Comment


              #7
              Originally posted by ASB View Post
              Hmm, I think that should pretty much do it. I need to review it and wrap it all up in a class I provide. Only issue I have is trying to hide it from my new developer as much as possible.
              That's what that does. Hides all the jiggery pokery from the UI and shifts the complexity to the "worker" classes.


              Have a look in the comments as there is a Generics solution suggested that reduces the coding.

              Comment


                #8
                Originally posted by voodooflux View Post
                From what you've said (and apologies if I've misunderstood) I still think Control.Invoke is what you want here - although you may wish to hide the implementation from your developer by wrapping the functionality in something more "friendly". Assuming I have understood correctly, Control.Invoke is provided for the exact scenario you describe.
                I agree in general. However the guy has only been on a quick introduction so it's all a bit confusing for him - hence the need to hide implementation details. On the other hand of course I don't want to have to do too much myself

                Comment


                  #9
                  Originally posted by DimPrawn View Post
                  Have a look in the comments as there is a Generics solution suggested that reduces the coding.
                  I noticed that, finally a use for generics my meagre brain can understand !

                  Comment


                    #10
                    Originally posted by ASB View Post
                    I agree in general. However the guy has only been on a quick introduction so it's all a bit confusing for him - hence the need to hide implementation details. On the other hand of course I don't want to have to do too much myself
                    Amen to that Shouldn't take too much to hide the gory detail from him though, but good luck with whichever solution you decide upon.
                    Where are we going? And what’s with this hand basket?

                    Comment

                    Working...
                    X