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

TypeConverter subclass doesn't port from NT7 to NT8

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

    TypeConverter subclass doesn't port from NT7 to NT8

    I am working on porting an indicator from NT7 to NT8, and I am stuck on something that works well in 7, but not too well in 8 - a customized dropdown box. Let me explain:

    I would like to add an option to the indicator that contains a list of all installed SpeechSynthesizer voices. Kind of like this:



    This works in NT7. In NT8, it shows the correct values in the dropdown box, but the selected value does not save. Each time I open the Indicators dialog I see the first value selected, even if I've chosen another value a moment ago. Same results are observed after a full restart of the NT software.

    Here is my TypeConverter class:

    Code:
    public class VoiceConverter : TypeConverter
    {
    
    	public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
    	{
    		if (context == null)
    			return null;
    
    		List<string> list = new List<string>();
    		var s = new SpeechSynthesizer();
    
    		foreach (InstalledVoice v in s.GetInstalledVoices())
    		{
    			list.Add(v.VoiceInfo.Name);
    		}
    
    		return new TypeConverter.StandardValuesCollection(list);
    	}
    
    	public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
    	{
    		return true;
    	}
    }
    And here is my property:

    Code:
    [TypeConverter(typeof(VoiceConverter))]
    public string Voice {
    	get; set;
    }
    Again, this code works well in NT7, but in NT8 it doesn't save the value.

    Any help would be greatly appreciated.

    #2
    Hello,

    Thank you for the post.

    I tried the sample you provided but can see this is working on my end. My system has two installed voices, I chose the Second in the list and closed the platform saving the workspace. Upon opening and checking the indicator I can see the second voice is still selected.

    Could you instead provide an export of the sample you are using for me to test?

    Also if you have been developing this item and have only been using F5 to reload it, please try removing it and re-adding it to the chart and re-check the results.



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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    5 views
    0 likes
    Last Post usazencortex  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    168 responses
    2,266 views
    0 likes
    Last Post sidlercom80  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X