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
private async void Handle_Clicked (object sender, System.EventArgs e) | |
{ | |
using (HttpClient client = new HttpClient ()) { | |
client.BaseAddress = new Uri (_baseApiUrl); | |
var fooString = await client.GetStringAsync ("posts"); | |
var fooCollection = JsonConvert.DeserializeObject<Foo []> (fooString); | |
ResultLabel.Text = $"{fooCollection [0].id} - {fooCollection [0].title}"; | |
} |
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
private async void Handle_Clicked_Awesome (object sender, System.EventArgs e) | |
{ | |
var fooCollection = await _restClient.GetPosts (); | |
ResultLabel.Text = $"{fooCollection [0].id} - {fooCollection [0].title}"; | |
} |
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
using System.Threading.Tasks; | |
using Refit; | |
namespace RefitTestApp | |
{ | |
public interface IRestClient | |
{ | |
[Get ("/posts")] | |
Task<Foo []> GetPosts (); | |
} |
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
using Refit; | |
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace RefitTestApp | |
{ | |
public class RestClient | |
{ | |
private readonly IRestClient _restClient; |
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
using System.Threading.Tasks; | |
using Refit; | |
namespace RefitTestApp | |
{ | |
public interface IRestClient | |
{ | |
[Get ("/posts")] | |
Task<Foo []> GetPosts (); |
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
// RestClient.cs | |
public async Task<Foo> GetPost (int id) | |
{ | |
return await _restClient.GetPost (id); | |
} | |
// Implementing event to retrieve post 3 | |
private async void Handle_Clicked_Awesome_3 (object sender, System.EventArgs e) | |
{ | |
var foo = await _restClient.GetPost (3); |
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
// IRestClient.cs | |
[Post ("/posts")] | |
Task AddPost (Foo foo); | |
// RestClient.cs | |
public async Task AddPost (Foo foo) | |
{ | |
await _restClient.AddPost (foo); | |
} |
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
<application android:hardwareAccelerated="true" ...> |
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
if ((int)Build.VERSION.SdkInt >= 19) { | |
Control.SetLayerType (Android.Views.LayerType.Hardware, null); | |
} else { | |
Control.SetLayerType (Android.Views.LayerType.Software, null); | |
} |
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
public class CustomWebViewRenderer : WebViewRenderer | |
{ | |
private static int FILECHOOSER_RESULTCODE = 1; | |
protected override void OnElementChanged (ElementChangedEventArgs<WebView> e) | |
{ | |
base.OnElementChanged (e); | |
var chromeClient = new FileChooserWebChromeClient ((uploadMsg, acceptType, capture) => { | |
MainActivity.UploadMessage = uploadMsg; |