protected EventCallback RetrieveMethodInfo(ITemplateDefinition templateDefinition, string option, string callbackName)
 {
     try
     {
         return(EventCallbacksManager.RetrieveCallback(templateDefinition, callbackName));
     }
     catch (Exception ex)
     {
         throw new Exception($"Property option '{option}'. {ex.Message}");
     }
 }
        private void RetrieveSelectionChangeMethod()
        {
            string selectionChanged = TemplateOption.SelectionChanged.EmptyIfNull();

            selectionChanged = selectionChanged.Trim();

            if (!string.IsNullOrEmpty(selectionChanged))
            {
                try
                {
                    SelectionChanged = EventCallbacksManager.RetrieveCallback(this, selectionChanged);
                }
                catch (Exception ex)
                {
                    throw new EtkException($"Retrieve 'SelectionChanged' method information failed:{ex.Message}");
                }
            }
        }
        private void RetrieveOnClickMethod()
        {
            if (!string.IsNullOrEmpty(Definition.Command))
            {
                try
                {
                    string onCommand = Definition.Command.Trim();
                    Command = EventCallbacksManager.RetrieveCallback(TemplateDefinition, onCommand);

                    if (!Command.IsNotDotNet)
                    {
                        ParameterInfo[] parameters = Command.Callback.GetParameters();
                        if (Command.Callback.IsStatic)
                        {
                            if (parameters.Count() > 2)
                            {
                                throw new EtkException($"Method dataAccessor must be 'void static {Command.Callback.Name}(object currentObject [, Range <currentObject caller>]'");
                            }

                            OnClickWithRange = parameters.Count() == 2;
                        }
                        else
                        {
                            if (parameters.Count() > 1 || (parameters.Count() == 1 && parameters[0].ParameterType != typeof(Microsoft.Office.Interop.Excel.Range)))
                            {
                                throw new EtkException($"Method dataAccessor must be 'void {Command.Callback.Name}([Range <currentObject caller>])'");
                            }

                            OnClickWithRange = parameters.Count() == 1;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new EtkException($"Get 'Command' methodInfo information failed:{ex.Message}");
                }
            }
        }