-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7607029
commit f80b7da
Showing
1 changed file
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,41 @@ | ||
# jsonrpc.framework.net | ||
# jsonrpc.framework.net | ||
|
||
A simple to use framework for json rpc requests | ||
|
||
## Example | ||
|
||
``` | ||
public partial class LoginPage : ContentPage | ||
{ | ||
private readonly jsonrpc.RPCClient rpc = new("http://192.168.1.66:8069/jsonrpc"); | ||
public LoginPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
private void OnLoginClicked(object sender, EventArgs e) | ||
{ | ||
_ = rpc.Invoke("call", new { | ||
service = "common", | ||
method = "login", | ||
args = new string[] { "bitnami", UnameField.Text, PasswordField.Text } | ||
}, onResponse); | ||
} | ||
private async void onResponse(jsonrpc.RPCResponse response) | ||
{ | ||
Debug.WriteLine(response); | ||
if(response.Error != null) | ||
{ | ||
Debug.WriteLine(response.Error); | ||
await DisplayAlert("RPC Error", response.Error.ToString(), "Cancel"); | ||
} | ||
} | ||
private void ImageLoaded(object sender, EventArgs e) | ||
{ | ||
Debug.WriteLine(ImageSplash); | ||
} | ||
} | ||
``` |