Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🐵monkeying around

Craig Dunn conceptdev

💭
🐵monkeying around
View GitHub Profile
View App.cs
using System;
using Xamarin.Forms;
namespace App8
{
public class App
{
public static Page GetMainPage ()
{
return new MyPage();
@conceptdev
conceptdev / EmbeddedImageResourceExtension.cs
Created Jun 9, 2014
Xamarin.Forms custom markup extension because there is no built-in TypeConverter for Images embedded as resources
View EmbeddedImageResourceExtension.cs
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 Apr 26, 2017
TranslateExtension for Xamarin.Forms Xaml. Note: the xmlns declaration in the <ContentPage> tag
View TodoItem.xaml
<?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 Sep 20, 2012
CoreImage new filters in iOS6 (for MonoTouch)
View SampleCode_iOS6.cs
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 Aug 31, 2012
Azure Mobile Services example request in MonoTouch
View TaskScreen.cs
// 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 Aug 24, 2012
MonoTouch port of Apple's iSO 5.1 in-app purchase vulnerability patch (partially complete)
View InAppPurchaseManager-snippet.cs
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 Aug 18, 2012
Access image metadata with MonoTouch (eg. GPS, EXIF data)
View AppDelegate.cs
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace AccessImageMetadata
{
public class Application
View Main.cs
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
Localizing the MonoTouch.Dialog Reflection API
View LocalizableBindingContext.cs
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
MonoTouch helper class for UIPasteboard
View ClipboardHelper.cs
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>
You can’t perform that action at this time.