Invoke() public method

Invoke the method. This function will never fail.
public Invoke ( object instance ) : void
instance object
return void
コード例 #1
0
ファイル: tkButton.cs プロジェクト: smbss1/fullinspector
            public Button(string methodName)
            {
                InspectedMethod foundMethod = null;

                foreach (var method in InspectedType.Get(typeof(T)).GetMethods(InspectedMemberFilters.All))
                {
                    if (method.Method.Name == methodName)
                    {
                        foundMethod = method;
                    }
                }

                if (foundMethod != null)
                {
                    _label   = (fiGUIContent)foundMethod.DisplayLabel;
                    _enabled = true;
                    _onClick = (o, c) => foundMethod.Invoke(o);
                }
                else
                {
                    Debug.LogError("Unable to find method " + methodName + " on " + typeof(T).CSharpName());
                    _label   = new fiGUIContent(methodName + " (unable to find on " + typeof(T).CSharpName() + ")");
                    _enabled = false;
                    _onClick = (o, c) => { };
                }
            }