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. MTA calling STA

MTA calling STA

Scheduled Pinned Locked Moved C#
helpquestioncsharpwpfdesign
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.
  • D Offline
    D Offline
    Don Rolando
    wrote on last edited by
    #1

    I am really turning nuts! I have the following problem: I have a library that is MTA by design - and I cannot modify it, I have only the assambly. So far so good, but my application is a WPF application. And that in turn is STA by design. So my simple question: How can both talk to each other? More precisely, there are no problems unless callbacks from the MTA-library are executed. I would like to give some feedback through the GUI, but nothing happens (ok, at least there is a caught exception that the GUI an only be modified from a STA thread... fine, so my delegate is still executed out of some library's thread) The simple delegate does not work, implementing a wrapper with some event does not either. Posting a "real" Windows Message and grabbing data out of the wrapper would work, but that cannot be the best answer for my problem... can it?? Any help appreciated to make my code some kind of more professional. ;P Don Rolando

    J L 2 Replies Last reply
    0
    • D Don Rolando

      I am really turning nuts! I have the following problem: I have a library that is MTA by design - and I cannot modify it, I have only the assambly. So far so good, but my application is a WPF application. And that in turn is STA by design. So my simple question: How can both talk to each other? More precisely, there are no problems unless callbacks from the MTA-library are executed. I would like to give some feedback through the GUI, but nothing happens (ok, at least there is a caught exception that the GUI an only be modified from a STA thread... fine, so my delegate is still executed out of some library's thread) The simple delegate does not work, implementing a wrapper with some event does not either. Posting a "real" Windows Message and grabbing data out of the wrapper would work, but that cannot be the best answer for my problem... can it?? Any help appreciated to make my code some kind of more professional. ;P Don Rolando

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

      When you get a callback from the MTA library, just post to the Dispatcher of your WPF app to do the UI-related work. See MSDN's WPF Threading Model[^] for more info.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Upon this disciple I'll build my new religion? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      D 1 Reply Last reply
      0
      • D Don Rolando

        I am really turning nuts! I have the following problem: I have a library that is MTA by design - and I cannot modify it, I have only the assambly. So far so good, but my application is a WPF application. And that in turn is STA by design. So my simple question: How can both talk to each other? More precisely, there are no problems unless callbacks from the MTA-library are executed. I would like to give some feedback through the GUI, but nothing happens (ok, at least there is a caught exception that the GUI an only be modified from a STA thread... fine, so my delegate is still executed out of some library's thread) The simple delegate does not work, implementing a wrapper with some event does not either. Posting a "real" Windows Message and grabbing data out of the wrapper would work, but that cannot be the best answer for my problem... can it?? Any help appreciated to make my code some kind of more professional. ;P Don Rolando

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        See if this helps[^]

        led mike

        D 1 Reply Last reply
        0
        • J Judah Gabriel Himango

          When you get a callback from the MTA library, just post to the Dispatcher of your WPF app to do the UI-related work. See MSDN's WPF Threading Model[^] for more info.

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Upon this disciple I'll build my new religion? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          D Offline
          D Offline
          Don Rolando
          wrote on last edited by
          #4

          You are my man! Thanks a lot, that was it! The Dispatcher... argh, of course. :)

          1 Reply Last reply
          0
          • L led mike

            See if this helps[^]

            led mike

            D Offline
            D Offline
            Don Rolando
            wrote on last edited by
            #5

            Thank a lot, but Judah's post gave me already the answer I searched for. (And it was about the same as the German page was about)

            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