Beispiel #1
0
        private async void Test()
        {
            var a = await InvokeAsync <long>("Add", 1, 5);

            ApiProvider.Log($"Client: result = {a}");

            await InvokeAsync("PrintMessage", "Hello world!");
            await InvokeAsync("PrintMessage", "Warning 1", LogLevel.Warning);
            await InvokeAsync("PrintMessage", "Warning 2", LogLevel.Warning.ToString());
            await InvokeAsync("PrintArray", new[] { new string[] { "Hello 1", "Hello 2" } });

            var b = await InvokeAsync <string>("ReturnString", "Hello world!");

            ApiProvider.Log($"Client: result = {b}");

            var c = await InvokeAsync <string>("ReturnString", "");

            ApiProvider.Log($"Client: result = {c}");

            try
            {
                await InvokeAsync("ThrowException", "Test error");
            }
            catch (Exception e)
            {
                ApiProvider.Log($"Client: error = {e}");
            }
        }