Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Threading issue

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

    Threading issue

    I get an exception.
    An exception of type 'System.InvalidOperationException' occurred in WindowsBase.dll but was not handled in user code

    Additional information: The calling thread cannot access this object because a different thread owns it.
    The exception comes from the following line of code. darkBullColor and darkBearColor are both of type System.Windows.Media.SolidColorBrush.
    Code:
    if (isUpTrend) PlotBrushes[rIndicatorPlot.index][0] = darkBullColor; else PlotBrushes[0][0] = darkBearColor;
    What am I doing wrong?

    --EV

    P.S. I think it is irrelevant, but rIndicatorPlot.index = 0, and PlotBrushes has 2 entries.
    Last edited by ETFVoyageur; 08-18-2015, 04:55 AM.

    #2
    Originally posted by ETFVoyageur View Post
    I get an exception.
    The exception comes from the following line of code. darkBullColor and darkBearColor are both of type System.Windows.Media.SolidColorBrush.
    Code:
    if (isUpTrend) PlotBrushes[rIndicatorPlot.index][0] = darkBullColor; else PlotBrushes[0][0] = darkBearColor;
    What am I doing wrong?

    --EV

    P.S. I think it is irrelevant, but rIndicatorPlot.index = 0, and PlotBrushes has 2 entries.
    Freeze() the brush after you create it.

    Comment


      #3
      Originally posted by koganam View Post
      Freeze() the brush after you create it.
      Thank you. That seems to have solved the problem.

      --EV

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jeronymite, 04-12-2024, 04:26 PM
      2 responses
      29 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by Mindset, 05-06-2023, 09:03 PM
      10 responses
      263 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by michi08, 10-05-2018, 09:31 AM
      5 responses
      742 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by The_Sec, Today, 02:29 PM
      0 responses
      4 views
      0 likes
      Last Post The_Sec
      by The_Sec
       
      Started by tsantospinto, 04-12-2024, 07:04 PM
      4 responses
      63 views
      0 likes
      Last Post aligator  
      Working...
      X