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

Addon development - windows linking mechanism

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

    Addon development - windows linking mechanism

    Hello,
    I'm currently building an addon for my use - with a new addon window.
    while linking work as i expect it to, when closing the ninja app, the selected color link initialize and doesn't saved with the workspace
    what should i do in order to save the current link color to the addon window?

    thank in advance

    #2
    Hello bugo11,

    It would be saved and restored with the IWorkspacePersistence restore and save methods.




    Code:
    protected override void Restore(XElement element)
    {
    if (element == null)
    return;
    
    XElement instrumentElement = element.Element("Instrument");
    if (instrumentElement != null && !string.IsNullOrEmpty(instrumentElement.Value))
    Instrument = Cbi.Instrument.GetInstrument(instrumentElement.Value);
    }
    
    protected override void Save(XElement element)
    {
    if (element == null)
    return;
    
    if (Instrument != null)
    element.Add(new XElement("Instrument") { Value = Instrument.FullName });
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hey Chelsea,
      I do have this code in my addon.xaml.cs
      but still the color does not restore and grayed out when restarting the program
      also, same thing is happaning with your Addon Example, the color is initialized on restart.

      hope you can help me solve this.

      Comment


        #4
        Hello bugo11,

        If you are referring to the AddonShell example, this does not implement this code to restore the Instrument property and does not implement the code for window linking. (Please review the code and you will see this code is not there.) Without the code implemented, the instrument linking will not restore with the workspace.


        Testing with IInstrumentProvider and restoring the instrument, I am not able to reproduce. The linked color is restoring with the workspace.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi again Chelsea, thanks for the fast reply
          i'm reffering to your addon framework example


          the window does not save the color selected in this window
          thanks in advance

          Comment


            #6
            Hello bugo11,

            I am not able to reproduce.

            Below is a link to a video showing the color linking is saved and restored with the workspace.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hey again Chelsea ,
              I've been able to find the problem, but this produce another problem

              the addon i'm building have few tabs, each different XAML and XAML.cs files.
              i was able to create a window with all the tabs when
              Code:
              TabControlManager.SetFactory(tc, new AddOnFrameworkWindowFactory());
              is deleted, then i was able to create new tabs with
              Code:
              tc.AddNTTabPage(new NinjaTraderAddOnProject.AddOnPage());
              (while changing the AddOnPage to the next page name)

              now i see that deleting the SetFactory mathod is breaking the linking mechanism.

              is there any way to create different tabs while maintaing the link mechanism?

              thank you in advance

              Comment


                #8
                Hello bugo11,

                I'm not certain. The example I have provided you has tabs and has window linking. Are you finding the InstrumentLinkTest script is inadequate for showing how to use window linking with a tab control?

                May I confirm that you were able to reproduce the issue using the AddonFrameworkBasic and have different results than what I have shown in the video?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chelsea,
                  thank you for your reply
                  it seems like the addonframework i used was slightly modified, after loading a fresh code it was fixed.

                  also i was able to figure how to add new uniqe tabs and keep the linking mechanism.

                  so thank you!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Taddypole, 04-26-2024, 02:47 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Eduardo  
                  Started by futtrader, 04-21-2024, 01:50 AM
                  6 responses
                  58 views
                  0 likes
                  Last Post futtrader  
                  Started by sgordet, Today, 11:48 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post sgordet
                  by sgordet
                   
                  Started by Trader146, Today, 11:41 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post Trader146  
                  Started by jpapa, 04-23-2024, 07:22 AM
                  2 responses
                  22 views
                  0 likes
                  Last Post rene69851  
                  Working...
                  X