コード例 #1
0
        internal async Task <T> SendScriptAsync <T>(string script,
                                                    [CallerMemberName] string member = null,
                                                    [CallerFilePath] string file     = null,
                                                    [CallerLineNumber] int line      = 0)
        {
            if (_initialized)
            {
                try
                {
                    return(await this._view.RunScriptAsync <T>(script, member, file, line));
                }
                catch (Exception e)
                {
                    InternalException?.Invoke(this, e);
                }
            }
            else
            {
                #if DEBUG
                System.Diagnostics.Debug.WriteLine("WARNING: Tried to call '" + script + "' before initialized.");
                #endif
            }

            return(default(T));
        }
コード例 #2
0
        internal async Task <T> InvokeScriptAsync <T>(
            string method,
            object[] args,
            bool serialize = true,
            [CallerMemberName] string member = null,
            [CallerFilePath] string file     = null,
            [CallerLineNumber] int line      = 0)
        {
            if (_initialized)
            {
                try
                {
                    return(await this._view.InvokeScriptAsync <T>(method, args, serialize, member, file, line));
                }
                catch (Exception e)
                {
                    InternalException?.Invoke(this, e);
                }
            }
            else
            {
                #if DEBUG
                System.Diagnostics.Debug.WriteLine("WARNING: Tried to call " + method + " before initialized.");
                #endif
            }

            return(default(T));
        }
コード例 #3
0
        internal async Task <string> InvokeScriptAsync(
            string method,
            object[] args,
            [CallerMemberName] string member = null,
            [CallerFilePath] string file     = null,
            [CallerLineNumber] int line      = 0,
            bool serialize = true)
        {
            if (_initialized)
            {
                try
                {
                    return(await this._view.InvokeScriptAsync(method, member, file, line, serialize, args));
                }
                catch (Exception e)
                {
                    InternalException?.Invoke(this, e);
                }
            }
            else
            {
                #if DEBUG
                Debug.WriteLine("WARNING: Tried to call " + method + " before initialized.");
                #endif
            }

            return(string.Empty);
        }