示例#1
0
        /// <summary>
        /// Set up a new instance of an <see cref="IntentRouter"/> using <see cref="IntentHandlerAttribute"/> flagged methods to handle the intents.
        /// </summary>
        /// <typeparam name="T">Type of handler</typeparam>
        /// <param name="client">The instance of the LuisClient to use</param>
        /// <param name="contextObject">The instance of the class that contains the flagged member functions to execute for each intent</param>
        /// <returns>A new instance of an <see cref="IntentRouter"/> that has registered intent handlers.</returns>
        public static IntentRouter Setup(LuisClient client, object contextObject)
        {
            var router = new IntentRouter(client);

            try
            {
                router.RegisterHandler(contextObject);
            }
            catch
            {
                router.Dispose();
                throw;
            }
            return(router);
        }
示例#2
0
        /// <summary>
        /// Set up a new instance of an <see cref="IntentRouter"/> using <see cref="IntentHandlerAttribute"/> flagged methods in <typeparamref name="T"/> to handle the intents.
        /// </summary>
        /// <typeparam name="T">Type of handler</typeparam>
        /// <param name="appId">The application ID of the LUIS application</param>
        /// <param name="appKey">The application subscription key of the LUIS application</param>
        /// <param name="preview">A flag indicating whether to use preview features or not (Dialogue)</param>
        /// <returns>A new instance of an <see cref="IntentRouter"/> that has registered intent handlers.</returns>
        public static IntentRouter Setup <T>(string appId, string appKey, bool preview = true)
        {
            var router = new IntentRouter(appId, appKey, preview);

            try
            {
                router.RegisterHandler <T>();
            }
            catch
            {
                router.Dispose();
                throw;
            }
            return(router);
        }
示例#3
0
        /// <summary>
        /// Set up a new instance of an <see cref="IntentRouter"/> using <see cref="IntentHandlerAttribute"/> flagged methods in <typeparamref name="T"/> to handle the intents.
        /// </summary>
        /// <typeparam name="T">Type of handler</typeparam>
        /// <param name="client">The instance of the LuisClient to use</param>
        /// <returns>A new instance of an <see cref="IntentRouter"/> that has registered intent handlers.</returns>
        public static IntentRouter Setup <T>(LuisClient client)
        {
            var router = new IntentRouter(client);

            try
            {
                router.RegisterHandler <T>();
            }
            catch
            {
                router.Dispose();
                throw;
            }
            return(router);
        }