Example #1
0
        /// <summary>
        /// Register the specified handler to handle the specified file extension.
        /// </summary>
        /// <param name="extension"></param>
        /// <param name="handler"></param>
        /// <param name="reset"></param>
        public static void RegisterServiceProxyRequestDelegate(string extension, ExecutionResultDelegate handler, bool reset = false)
        {
            if (_actions == null)
            {
                lock (actionsLock)
                {
                    _actions = new Dictionary <string, ExecutionResultDelegate>();
                }
            }

            if (_actions.ContainsKey(extension) && reset)
            {
                _actions[extension] = handler;
            }
            else if (!_actions.ContainsKey(extension))
            {
                _actions.Add(extension, handler);
            }
            else if (_actions.ContainsKey(extension) && !reset)
            {
                throw new InvalidOperationException("The handler for the extension ({0}) has already been set.");
            }
        }
Example #2
0
 /// <summary>
 /// Register the specified handler to handle the specified file extension.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="handler"></param>
 /// <param name="reset"></param>
 public static void RegisterServiceProxyRequestDelegate(string extension, ExecutionResultDelegate handler, bool reset = false)
 {
     ServiceProxyController.RegisterServiceProxyRequestDelegate(extension, handler, reset);
 }