• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT Loaded/Show

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

    NT Loaded/Show

    Hi,

    I am well aware that the following is not officially supported and likely will not get a response from the NT support staff, but I am asking in the hope that someone in the community may have some information that might help me.

    I have a piece of code that I need to execute once NT has loaded/enabled and rendered to the screen. I am aware that NT is likely a wpf STA thread application, likely using an automatically generated Main function. I have tried using Dispatcher.Invoke to execute my function and it works very nicely once NT is up and running (i.e. starting with a blank Workspace and just the Control Center window). However, and here is the issue, if I create a chart and save the workspace, and then relaunch NT, NT stalls. There are no error messages and nothing obviously wrong in the trace or log files. If I right click on the NT icon in the Windows taskbar a few times, it loads and works fine. It seems therefore that perhaps my code is somehow interfering in some way with MainWindow.Show() or the mechanism that renders the NT windows to the screen - the last bit before NT is ready to go. I am guessing here though.

    So, does anyone know if there is an event (or something) that I might be able to subscribe to (or check) that would tell me whether NT is loaded and enabled so that I might execute my code on that event? Alternatively, has anyone tried running custom code async, or on another thread, and having it interact with the UI once NT has rendered to the screen? Any insight would be greatly appreciated. Thank you.

    #2
    Hello Zeos6,

    Thanks for the post.

    For Addons, you have the OnWindowCreated function to check if the Control Center is open. Please see the attached example of a basic addon. For a .NET approach to this, you could query the System for all running processes the following public link describes this further.

    https://stackoverflow.com/questions/...ess-is-running

    Please let me know if you have any questions.
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much ChrisL. I will check this out, and will let you know if this does the trick. Your help is much appreciated.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Botan626, Today, 04:43 AM
      0 responses
      4 views
      0 likes
      Last Post Botan626  
      Started by xsgex, Yesterday, 09:46 PM
      0 responses
      3 views
      0 likes
      Last Post xsgex
      by xsgex
       
      Started by Steve L, Yesterday, 09:36 PM
      0 responses
      6 views
      0 likes
      Last Post Steve L
      by Steve L
       
      Started by krugman25, Yesterday, 09:34 PM
      0 responses
      4 views
      0 likes
      Last Post krugman25  
      Started by indy73, Yesterday, 04:42 PM
      0 responses
      15 views
      0 likes
      Last Post indy73
      by indy73
       
      Working...
      X