Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Error with your VS sample add on file

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

    Error with your VS sample add on file

    when i am openning, I am seeing this error like the screenshot. I have not modified anything from your standard file which is available for addon development on your help guide for VS. see the screenshot.

    #2
    Hello asmmbillah,

    Thanks for the post.

    What you are seeing is correct, the visual studio xaml designer is generally unable to compile the xaml because the NinjaTrader controls are not made to be used with the designer.

    You would need to use the code view and design the xaml using xaml code. You can alternatively make an normal WPF xaml page which is not a NinjaTrader control and design normal XAML controls in that with the designer. When you then want to use it as the xaml for your NinjaScript you could go through and copy/paste the relevant parts into the NTTabPage xaml. Keep in mind working on xaml in this context is not like working on xaml in a normal WPF application so using items like bindings or events will not work, you would need to do those items in the C# code of the addon.

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

    Comment


      #3
      Hi,
      I've just started playing with Addons... the "Addon Framework Basic" thing imports and runs fine... but I also D/L'd the VS solution version... which builds in VS, but after copyjng the DLL & pdb, when I run it I am getting a "Set connectionId threw an exception.." error. I have started from scratch (ie restarted both NT and VS), ensured NT Custom.csproj is updated after a recompile... but the problem persists. Only other thing I did since starting to play was to install Blend... as I really want to be able to design the XAML in WYSIWYG, not code...

      I also found Jessica's video on how to do this stuff... have done the same process.

      Any pointers appreciated... I know VS is not really supported, but it sure would help if I can get started in VS...I have cut heaps of code in VS... but never an Addon before. My plan was to hack away much of the AddonProject complexity... and have a working Addon... but even making NO changes... it just spits the dummy...

      Click image for larger version  Name:	Addon Exception.png Views:	0 Size:	3.9 KB ID:	1121553
      PS Using NT8 8.0.22.1 and VS 2019 Pro

      Regards,
      T.
      Last edited by tgn55; 10-07-2020, 02:16 AM.

      Comment


        #4
        Hello tgn55,

        I tried the sample from the help guide but did not see this error. Was there a specific action you did when this came up or is that just happening during loading? Do you also have both addons imported at the same time?

        A comment for the xaml, if the intention is to make styles or style NinjaTrader controls keep in mind that you cannot use the xaml editor in visual studio for any NinjaTrader control. That editor would only be useful for standard C# controls and xaml design. We usually suggest to just make a empty WPF project if you need to work with the xaml designer, you can then copy/paste the generated xaml as you need it into the NinjaScript xaml.

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

        Comment


          #5
          Hey Jesse...
          I get this error immediately after clicking on the New-->Addon Framework Control Panel menu item. No I don't have both loaded... but I did previously import the Basic ie non-VS version... which worked fine.

          Really, all I want is a working starting point in VS... I am happy to totally create all the controls myself.. I have already done so in a separate (Non-Ninja) VS windows application... just trying to now convert it over to a Ninja addon. I also ran the "Addon Shell" thing one of the NT team created... but it's not a VS solution, so I can't hack that.

          I would be happy to just start from scratch in VS... but I never made a DLL before... most of my VS experience has been in cutting strategies, indicators etc...and recently, this windows forms app.
          Summary: I cut heaps of NT stuff... but am not really a seasoned .NET developer... still got trainer wheels on. So I'm not 100% sure how to "start from scratch" correctly to make an Addon DLL. I do understand the basic addon base class logic... it's all the other stuff about WindowFactories etc that is a bit over my head, hence I was hoping to piggy-back off an existing VS solution that already had that stuff in place ;-)

          PS... this little project is all about the infamous nonsense trade reports resulting from starting trades with an exit... I wrote about this a lot several months back in https://ninjatrader.com/support/foru...is-wrong/page2...
          I now have an (almost) final version of my replacement logic... including grouping trades, selectable FIFO/LIFO processing etc. Just ironing a remaining wrinkle... but, I'll say more in the other thread !

          Thanks for your assistance,
          T.
          Last edited by tgn55; 10-08-2020, 08:46 AM.

          Comment


            #6
            Hello tgn55,

            Below is a link to a short video that demonstrates including xaml files in the project and then loading in the xaml designer for both the AddonShellPageContent.xaml and AddonFrameworkTab.xaml.


            Note that any NinjaTrader controls, like NTTabPage, NTMenu and NTMenuItem, QuantityUpDown, Atm, and Instrument selectors cannot be loaded in the designer.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              OK... finally got something working, thanks. I only loaded the AddonShell, The Framework thing is way more complex than I need.
              I did get build errors... re Infragistics, but I guess the .csproj file was updated anyway

              So... just simply adding another button on the Addon page... I had to manually add code to create the button object... then add event handlers for click, cleanup to remove on dispose etc... which all seems very primitive.

              Is that as good as it gets? Or am I missing something?
              Would doing design in Blend be a better option?

              Thanks,
              T.

              Comment


                #8
                Hello T,

                Are you getting an error when adding a button from the toolbox in visual studio?

                The xaml is not going to have a code behind to a .cs file.

                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by selu72, Today, 02:01 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Started by WHICKED, Today, 02:02 PM
                2 responses
                12 views
                0 likes
                Last Post WHICKED
                by WHICKED
                 
                Started by f.saeidi, Today, 12:14 PM
                8 responses
                21 views
                0 likes
                Last Post f.saeidi  
                Started by Mikey_, 03-23-2024, 05:59 PM
                3 responses
                51 views
                0 likes
                Last Post Sam2515
                by Sam2515
                 
                Started by Russ Moreland, Today, 12:54 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X