Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New "Path"-DrawingTool conflicts with Microsoft .NET's PATH-class

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

    New "Path"-DrawingTool conflicts with Microsoft .NET's PATH-class

    I use a Drawing Tool that reads some files from the filesystem, using .NET's System.IO -> PATH-class, something like


    using System.IO;
    ...
    string[] filenames = Directory.GetFiles(myTemplateFolder, "*.XML");
    int numfiles = filenames.Count();
    int x = 0;
    for (int y = 0; y <= numfiles - 1; y++) {
    string newname = Path.GetFileNameWithoutExtension(filenames[y]);
    ....
    }


    This Path-call cannot be compiled anymore with latest NT8-version 8.0.17.0 since it results in
    'NinjaTrader.NinjaScript.DrawingTools.Path' does not contain a definition for 'GetFileNameWithoutExtension'

    How can I avoid this conflict an bring my code back to life?

    Thanks in adavance for any help

    #2
    Hello RonnyKeller,

    Thank you for the post.

    In this situation the reason this worked previously is that NinjaTrader did not specifically have any tools named "Path" so the System.IO.Path object was being used which GetFileNameWithoutExtension is a method of.

    After the update, NinjaTrader includes a Path drawing tool which you can see the name of in your error:
    'NinjaTrader.NinjaScript.DrawingTools.Path' does not contain a definition for 'GetFileNameWithoutExtension'
    You will need to make your code more specific by using the fully qualified name so the correct Path class is used:

    Code:
    System.IO.Path.GetFileNameWithoutExtension(...)
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Excellent, thank you very much for the quick help! Works again as intended

      Comment


        #4
        hello,

        I have a problem wit PointF.

        Normally PointF is in System.Drawing but Ninjatrader don't find it.

        example :

        namespace NinjaTrader.NinjaScript.Indicators
        {

        public class RegressionM : Indicator
        {

        private int Size;


        private List<PointF> Points = new List<PointF>();


        I think that I must add something to do that. ( using ....)

        thank you

        Comment


          #5
          Hello oceanis400,

          Thank you for the question.

          The items in the System.Drawing namespace are no longer available because that is no longer used in NT8 or referenced. You can find examples of the newer point syntax which is used in rendering in the SampleCustomRender indicator.

          Depending on the use case you may want to use either a SharpDX.Vector2 or a System.Windows.Point.


          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            hello Jesse,

            I would like keep original code of this indicator.

            Is there a way to use System Drawing in NT8 and compile it. (With no error on PointF).

            a DLL with it was correct 2 years ago but now I have this problem.


            thank you to help me


            Comment


              #7
              Hello oceanis400,

              Thank you for your reply.

              I appreciate that you are trying to preserve the code, however, if you are doing anything with rendering or the GUI for this use case I would highly suggest avoiding using the old reference for System.Drawing and instead re write the code to work for NT8 and its updated references. NT8 now uses wpf for its window framework and sharpdx for rendering, the objects you will find in NinjaScript will be from these frameworks now. I could suggest modifying what you have to use these frameworks or just use one of the included vector2 or windows.point instead of pointf.

              It looks like these questions are also not related to the question of the original post, so please ensure to follow up in a new thread of your own if you have other questions on this topic.



              I look forward to being of further assistance.

              JesseNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 02:12 AM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by briansaul, Today, 05:31 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by PaulMohn, Today, 03:49 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by frslvr, 04-11-2024, 07:26 AM
              6 responses
              106 views
              1 like
              Last Post NinjaTrader_BrandonH  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              6 responses
              26 views
              0 likes
              Last Post trilliantrader  
              Working...
              X