Skip to content

Instantly share code, notes, and snippets.

public Task<T> Delete<T>(string method, string id)
{
throw new NotImplementedException();
}
public async Task<T> GetOne<T>(string method, Dictionary<string, object> parameters = null)
{
var stopWatch = System.Diagnostics.Stopwatch.StartNew();
var nativeHandler = new NativeMessageHandler();
public interface IHttpServices
{
Task<IEnumerable<T>> Get<T>(string method, Dictionary<string, object> parameters = null);
Task<T> GetCustom<T>(string url, Dictionary<string, object> parameters = null);
Task<T> Get<T>(string method, string id, Dictionary<string, object> parameters = null);
Task<ListaPages<T>> GetPagina<T>(string method, Dictionary<string, string> parameters = null, int retry = 0);
@rafaelrmou
rafaelrmou / DeviceHelper.cs
Created May 16, 2017 18:51
DeviceHelper.cs for Xamarin.Forms OnPlatform deprecated
public static class DeviceHelper
{
public static T OnRuntimePlatform<T>(T t1, T t2, T t3, T t4)
{
switch (Device.RuntimePlatform)
{
case Device.Android:
return t1;
case Device.iOS:
return t2;
public void DidPickDocumentPicker (UIDocumentMenuViewController documentMenu, UIDocumentPickerViewController documentPicker)
{
documentPicker.DidPickDocument += DocumentPicker_DidPickDocument;
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController (documentPicker, true, null);
}
void DocumentPicker_DidPickDocument (object sender, UIDocumentPickedEventArgs e)
{
var securityEnabled = e.Url.StartAccessingSecurityScopedResource ();
public class ViewMqtt : ContentPage{
void Btn_Clicked (object sender, EventArgs e)
{
var client = DependencyService.Get<IFMqttClient> ();
client.Connect ("borkerLink");
client.Publish ("topicoQueRecebeMensagem", Encoding.UTF8.GetBytes ("mensagemEnviada"));
var topics = new string[] {
"Topico1 a ser assinado (subscribe)"
};
[assembly: Xamarin.Forms.Dependency (typeof(FMqttClient))]
namespace Mqtt_Forms.iOS
{
public class FMqttClient : IFMqttClient
{
public MqttClient client {
get;
set;
}
public interface IFMqttClient
{
void Connect (string server);
void Publish (string service, byte[] command);
void Subscribe (string[] topics);
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Badge.iOS;
using UIKit;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using Foundation;
using CoreGraphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace AppTestForFastMapper.iOS
{
[Register("AppDelegate")]
using System;
namespace AppTestForFastMapper
{
/// <summary>
/// Classe de domínio.
/// </summary>
public class Pessoa
{
public int Id { get; set; }