Skip to content

Instantly share code, notes, and snippets.

View conceptdev's full-sized avatar
💭
🐵monkeying around

Craig Dunn conceptdev

💭
🐵monkeying around
View GitHub Profile
@conceptdev
conceptdev / App.cs
Created August 14, 2014 03:02
Attempt to repro JIT issue with Xamarin.Forms http://forums.xamarin.com/discussion/comment/70473
using System;
using Xamarin.Forms;
namespace App8
{
public class App
{
public static Page GetMainPage ()
{
return new MyPage();
@conceptdev
conceptdev / EmbeddedImageResourceExtension.cs
Created June 9, 2014 23:06
Xamarin.Forms custom markup extension because there is no built-in TypeConverter for Images embedded as resources
using System;
using Xamarin.Forms.Xaml;
using Xamarin.Forms;
namespace WorkingWithImages
{
// You exclude the 'Extension' suffix when using in Xaml markup
[ContentProperty ("Source")]
public class ImageResourceExtension : IMarkupExtension
{
@conceptdev
conceptdev / TodoItem.xaml
Last active April 26, 2017 16:33
TranslateExtension for Xamarin.Forms Xaml. Note: the xmlns declaration in the <ContentPage> tag
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i18n="clr-namespace:QuickTodo;assembly=QuickTodo"
x:Class="TodoXaml.TodoItemXaml">
<ContentPage.Content>
<StackLayout VerticalOptions="StartAndExpand">
<Label Text="{i18n:Translate Name}" />
@conceptdev
conceptdev / SampleCode_iOS6.cs
Created September 20, 2012 01:58
CoreImage new filters in iOS6 (for MonoTouch)
using System;
using MonoTouch.CoreImage;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
// CoreImage Filter Reference
//https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CoreImageFilterReference/Reference/reference.html
namespace CoreImage
{
@conceptdev
conceptdev / TaskScreen.cs
Created August 31, 2012 08:32
Azure Mobile Services example request in MonoTouch
// credit for Objective-C version to http://chrisrisner.com/Windows-Azure-Mobile-Services-and-iOS
GetAllUrl = "https://taskyazure.azure-mobile.net/tables/TodoItem?$filter=(complete%20eq%20false)";
AddUrl = "https://taskyazure.azure-mobile.net/tables/TodoItem";
UpdateUrl = "https://taskyazure.azure-mobile.net/tables/TodoItem/"; // slash on purpose
string MobileServiceAppId = "xxxxxxxxxxxxxxxxxxxxxxxx"; // your application key
void LoadTodos()
{
WebClient client = new WebClient();
@conceptdev
conceptdev / InAppPurchaseManager-snippet.cs
Created August 24, 2012 03:11
MonoTouch port of Apple's iSO 5.1 in-app purchase vulnerability patch (partially complete)
public void CompleteTransaction (SKPaymentTransaction transaction)
{
Console.WriteLine ("CompleteTransaction " + transaction.TransactionIdentifier);
var productId = transaction.Payment.ProductIdentifier;
// Independently verify the receipt via a web request (blocking, synchronous call)
if (ReceiptValidation.VerificationController.SharedInstance.VerifyPurchase (transaction)) {
Console.WriteLine ("Verified!");
// Register the purchase, so it is remembered for next time
FULFILL_PRODUCT (productId);
@conceptdev
conceptdev / AppDelegate.cs
Created August 18, 2012 00:23
Access image metadata with MonoTouch (eg. GPS, EXIF data)
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace AccessImageMetadata
{
public class Application
@conceptdev
conceptdev / Main.cs
Created June 8, 2012 06:39
PickerView01
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace PickerView01
{
public class Application
@conceptdev
conceptdev / LocalizableBindingContext.cs
Created May 31, 2012 23:45
Localizing the MonoTouch.Dialog Reflection API
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.Dialog;
@conceptdev
conceptdev / ClipboardHelper.cs
Created May 14, 2012 05:07
MonoTouch helper class for UIPasteboard
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Clipboard {
public static class ClipboardHelper {
/// <summary>
/// Inserts HTML to clipboard, so you can paste into Mail.app
/// </summary>
/// <remarks>