Skip to content

Instantly share code, notes, and snippets.

View peterfoot's full-sized avatar

Peter Foot peterfoot

View GitHub Profile
@peterfoot
peterfoot / SingleTapButtonRender.cs
Created May 5, 2016 19:38
Single Tap Xamarin Forms Button Renderer for Android
using Android.Views;
[assembly: Xamarin.Forms.ExportRenderer(typeof(Xamarin.Forms.Button), typeof(InTheHand.Forms.Platform.Android.SingleTapButtonRenderer))]
namespace InTheHand.Forms.Platform.Android
{
public sealed class SingleTapButtonRenderer : Xamarin.Forms.Platform.Android.ButtonRenderer
{
bool justClicked = false;
public override bool OnFilterTouchEventForSecurity(MotionEvent e)
using System;
namespace Xamarin.Forms.Platform.WinRT
{
public static class ColorExtensions
{
public static Windows.UI.Color ToWindows(this Xamarin.Forms.Color color)
{
return Windows.UI.Color.FromArgb(Convert.ToByte(color.A * 255), Convert.ToByte(color.R * 255), Convert.ToByte(color.G * 255), Convert.ToByte(color.B * 255));
}
@peterfoot
peterfoot / OnPlatform2.cs
Created October 13, 2015 19:25
Replacement for Xamarin.Forms.OnPlatform which supports the Windows (WinRT) platforms.
namespace InTheHand.Forms
{
/// <summary>
/// Replacement for Xamarin.Forms.OnPlatform which supports the Windows (WinRT) platforms.
/// </summary>
/// <typeparam name="T"></typeparam>
public sealed class OnPlatform2<T>
{
public OnPlatform2()
{
namespace InTheHand.Net
{
/// <summary>
/// Helper network-order conversion functions for the Universal Windows Platform.
/// </summary>
public static class IPAddress
{
/// <summary>
/// Converts a short value from network byte order to host byte order.
/// </summary>
using System;
namespace InTheHand
{
/// <summary>
/// Helper class for DateTimeOffset.
/// </summary>
public static class DateTimeOffsetHelper
{
private static DateTimeOffset dt = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);