How to check voice.mark-done-on-release option from custom code

189 views Asked by At

In our Workspace customization I need to check if the voice.mark-done-on-release option is set to true. Using a decompiler I can see that this option is exposed in Genesyslab.Desktop.Modules.Voice.VoiceOptions object as property VoiceMarkDoneOnRelease - but how can I get to that?

I can see that all I would need to do is get the value from the ConfigManager but it would be nice to reference the public property instead so that if it ever changes the compiler will know about it.

 namespace Genesyslab.Desktop.Modules.Voice
 {
     public class VoiceOptions : Options
     {
     ...
         public bool VoiceMarkDoneOnRelease
         {
             get
             {
                 return this.configManager.GetValueAsBoolean("voice.mark-done-on-release", false);
             }
         }
1

There are 1 answers

0
Eric Scherrer On

The best way I could find is to inject the IConfigManager and instantiate your own instance of VoiceOptions:

using Genesyslab.Desktop.Infrastructure.Configuration;

namespace YourNamespace
{
    public class YourClass
    {
        private readonly IConfigManager _genesysConfigManager;

        public CAMSessionService(IConfigManager genesysConfigManager)
        {
            _genesysConfigManager = genesysConfigManager;
        }

        private VoiceOptions GetVoiceOptions()
        {
            return VoiceOptions.CreateNewInstance(_genesysConfigManager);
        }
}