Exemplo n.º 1
0
        private static VoiceService CreateType(VoiceServiceInformation info, CustomerSession customerSession)
        {
            VoiceService service = null;

            try
            {
                string fullQualifiedType;

                if (string.IsNullOrEmpty(info.Assembly))
                {
                    fullQualifiedType = info.VoiceServiceType;
                }
                else
                {
                    fullQualifiedType = string.Concat(info, ", ", info.Assembly);
                }

                Type   t = Type.GetType(fullQualifiedType, true);
                object o = Activator.CreateInstance(t, customerSession);
                service = (VoiceService)o;
            }
            catch (TypeLoadException e)
            {
                customerSession.Logger.Log(e);
            }

            return(service);
        }
Exemplo n.º 2
0
        public static bool TryGetVoiceServiceInstance(string id, CustomerSession customerSession, out VoiceService voiceService)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }

            voiceService = null;
            VoiceServiceInformation info = null;

            if (ApplicationConfiguration.TryGetVoiceServiceInformation(id, out info))
            {
                voiceService = CreateType(info, customerSession);
            }

            return(voiceService != null);
        }