コード例 #1
0
        protected override bool Execute(string name, CefV8Value obj,
                                        CefV8Value[] arguments, out CefV8Value returnValue,
                                        out string exception)
        {
            string result = string.Empty;

            switch (name)
            {
            case "MyFunction":
                MyFunction();
                break;

            case "GetMyParam":
                result = GetMyParam();
                break;

            case "SetMyParam":
                result = SetMyParam(arguments[0].GetStringValue());
                break;

            default:
                MessageBox.Show(string.Format("JS调用C# >> {0} >> {1} 返回值",
                                              name, obj.GetType()), "系统提示", MessageBoxButtons.OK);
                break;
            }
            returnValue = CefV8Value.CreateString(result);
            exception   = null;
            return(true);
        }