Update GTK RemoteAgents
[CSharpForFun/.git] / Mono / RemoteAgents / GTKLinux / ViewModel / ViewModel.cs
1 using System.Threading.Tasks;
2 using GumartinM.JsonRPC4NET;
3
4 namespace Example.RemoteAgents.GTKLinux.ViewModel
5 {
6   public class ViewModelImpl
7   {
8     private static readonly string uriGetCurrentDate = "http://127.0.0.1:8080/spring-mainapp/CurrentDateService.json";
9     private static readonly string uriSetWriteText = "http://127.0.0.1:8080/spring-mainapp/WriteTextService.json";
10     private readonly JsonRpcHttpAsyncClient _remoteClient = new JsonRpcHttpAsyncClient(); 
11
12     async public Task<string> GetCurrentDateAsync()
13     {
14       return await _remoteClient.PostRemoteServiceAsync<string>(uriGetCurrentDate, "getCurrentDate");
15     }
16
17     async public Task SetWriteTextAsync(params object[] parameters)
18     {
19       await _remoteClient.PostRemoteServiceAsync(uriSetWriteText, "setWriteText", parameters);
20     }
21   }
22 }
23