I canīt reach a NinjaScript method (Draw()) from a custom event. The behaviour is the same if a do it with or without passing the event through TriggerCustomEvent()/MyCustomHandler(). Most code is reached, such as Print() and MessageBox, wich makes it hard to find the logic causing the problem. Help is appreciated:
protected override void OnStateChange() { .. else if (State == State.Configure) { wa = new WebAutomation(); wa.IsLoggedInEvent += OnIsLoggedIn; } } protected void OnIsLoggedIn() { TriggerCustomEvent(MyCustomHandler, 0, null); } public void MyCustomHandler(object state) { DrawLabels(); } protected void DrawLabels() { if (CurrentBar != Bars.Count-2) return; // Draw on last bar only Print("Hello Print!"); // WORKS! MessageBox.Show("Hello MessageBox!" // WORKS! Draw.TextFixed(this, "textLabel", "Hello Label!"...); // FAILS! }
Comment