Skip to content

Instantly share code, notes, and snippets.

View JonDouglas's full-sized avatar
📦
Busy working on NuGet. I'll try my best to get around to you.

Jon Douglas JonDouglas

📦
Busy working on NuGet. I'll try my best to get around to you.
View GitHub Profile
C:\Users\Jon\Documents\Visual Studio 2013\Projects\App11>msbuild App11.sln /t:Bu
ild /p:Configuration=Ad-Hoc;Platform=iPhone
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34014]
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 12/2/2014 9:58:45 AM.
Project "C:\Users\Jon\Documents\Visual Studio 2013\Projects\App11\App11.sln" on
@JonDouglas
JonDouglas / gist:b9fa806f40365acf3cbb
Created September 29, 2014 20:18
Xamarin Forms Renderers
Platform Specific renderers can be found in the following namespaces:
iOS: Xamarin.Forms.Platform.iOS
Android: Xamarin.Forms.Platform.Android
Windows Phone: Xamarin.Forms.Platform.WinPhone
Base Renderer
To start with, all renders usually derive from a platform specific base renderer class that in turn inherit from a platform specific control. If you want to create platform specific renderers from scratch you are probably going to be deriving them from the correct platform's base renderer class. These have been substantially standardized in version 6201 with all controls inheriting from a generic version of ViewRenderer. There is also a non-generic version that appears to be used sometimes by navigation controls. The methods on these classes are also more in line with each other than they had been but still not the same. For example the iOS version has a method called ViewOnUnfocusRequested while the Android's version of the same method is called OnUnfocusRequested.
iOS:
<application ... >
...
<!-- The main/home activity (it has no parent activity) -->
<activity
android:name="com.example.myfirstapp.MainActivity" ...>
...
</activity>
<!-- A child of the main activity -->
<activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
@JonDouglas
JonDouglas / gist:d1bf08dce57c814914cb
Created September 25, 2014 16:27
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="NewCameraBroadcast.NewCameraBroadcast" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
<application android:label="NewCameraBroadcast" android:icon="@drawable/Icon"></application>
<uses-feature android:name="android.hardware.camera"></uses-feature>
<uses-permission android:name="android.permission.CAMERA" />
</manifest>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace NewCameraBroadcast
{
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
public static ApplicationUserManager Create(
IdentityFactoryOptions<ApplicationUserManager> options,
IOwinContext context)
@JonDouglas
JonDouglas / gist:f8b0e3e306b3b9a8371f
Created September 10, 2014 20:21
FormsRelativeLayout
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace FormsPlayground
{
class RelativeLayoutDemoPage : ContentPage
@JonDouglas
JonDouglas / servicecontainer.cs
Last active August 29, 2015 14:03
ServiceContainer
public static class ServiceContainer
{
static readonly Dictionary<Type, Lazy<object>> services = new Dictionary<Type, Lazy<object>>();
public static void Register<T>(Func<T> function)
{
services[typeof(T)] = new Lazy<object>(() => function());
}
public static T Resolve<T>()
@JonDouglas
JonDouglas / Rounding
Last active August 29, 2015 13:56
Rounding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Rounding
{
public class Program
{
public static void Main(string[] args)