• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Invoking into HB's GUI thread?

    Discussion in 'Archives' started by yury2808, Aug 3, 2011.

    1. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      Heya,

      I'm implementing some threaded actions in my (not yet released) plugin for HB, and wonder what would be right way to invoke into GUI thread, or the thread where is safe to run LUA, access WoWItem objects database etc.

      First idea was to use:

      "Honorbuddy.App.Current.MainWindow.Dispatcher" for invoking, but access to this one is not possible at the time plugin "pulsing".

      So, if anyone do the threadings in their plugins - by what object and what time you get threads synchronized to the place where it's safe to do stuff?

      Thank you,

      Me.

      ps. if I do stuff in my thread without invoking - I get following exceptions:

      [21:27:37:187] PULSE: Cannot read a descriptor on an invalid object.
      at Styx.WoWInternals.WoWObjects.WoWObject.GetStorageField[T](UInt32 field)
      at Styx.WoWInternals.WoWObjects.WoWObject.GetStorageFieldByOffsetIndex[T](Int32 offsetIndex)
      at Styx.WoWInternals.WoWObjects.WoWUnit.GetCurrentPower(WoWPowerType type)
      at Styx.WoWInternals.WoWObjects.WoWUnit.GetPowerInfo(WoWPowerType type)
      at Styx.WoWInternals.WoWObjects.WoWUnit.get_HealthPercent()
       
    2. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      Meanwhile, found the (seem to be) working answer by myself:


      // setup dispatcher
      MainDispatcher = Dispatcher.CurrentDispatcher;

      ..

      MainDispatcher.BeginInvoke(PulseThreadDelegate, ...);

      ..

      Will test it further, but for some time works fine.
       
    3. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      EDIT: nop, this works unstable... still searching for a solution :(
       

    Share This Page