Skip to content

Instantly share code, notes, and snippets.

@slodge
slodge / gist:1393086
Created November 25, 2011 09:00
Refactoring this... Ctrl R+M
try
{
return (IMXActionResult)actionMethodInfo.Invoke(this, argumentList.ToArray());
}
catch (ArgumentException exception)
{
// this should be impossible - as we've checked the types in the GenerateActionMap method
return ShowError("parameter type mismatch seen " + exception.Message);
}
catch (TargetParameterCountException exception)
@slodge
slodge / gist:1393088
Created November 25, 2011 09:01
This result... Ctrl R+M
private IMXActionResult MxActionResult(MethodInfo actionMethodInfo, List<object> argumentList)
{
try
{
return; // return (IMXActionResult)actionMethodInfo.Invoke(this, argumentList.ToArray());
}
catch (ArgumentException exception)
{
// this should be impossible - as we've checked the types in the GenerateActionMap method
return; // return ShowError("parameter type mismatch seen " + exception.Message);
@slodge
slodge / nanoioc
Created March 14, 2012 15:03
just added a build method
//-----------------------------------------------------------------------
// <copyright file="NanoIoC.cs" company="Matt lacey Limited">
// Copyright © 2012 Matt Lacey
// </copyright>
//-----------------------------------------------------------------------
namespace Mrlacey
{
using System;
using System.Collections.Generic;
@slodge
slodge / System.Net.cs
Created April 29, 2012 09:42
My MonoDroid System.Net so far - work in progress
using System.Runtime.CompilerServices;
/*
* not available in MonoDroid :/
[assembly: TypeForwardedTo(typeof(System.Net.Sockets.UdpAnySourceMulticastClient))]
[assembly: TypeForwardedTo(typeof(System.Net.Sockets.UdpSingleSourceMulticastClient))]
[assembly: TypeForwardedTo(typeof(System.Net.DnsEndPoint))]
[assembly: TypeForwardedTo(typeof(System.Net.WriteStreamClosedEventHandler))]
[assembly: TypeForwardedTo(typeof(System.Net.WriteStreamClosedEventArgs))]
*/
@slodge
slodge / ShowAllSystemNetTypes.cs
Created April 29, 2012 09:52
Export all types in System.Net
public class ShowAllSystemNetTypes
{
public void DoShowAll()
{
foreach (var type in typeof(WebRequest).Assembly.GetExportedTypes())
{
Debug.WriteLine("[assembly: TypeForwardedTo(typeof({0}))]", type.FullName);
}
}
}
using System;
using System.Reflection;
using Cirrious.MvvmCross.Binding.Android.Views;
using Cirrious.MvvmCross.Binding.Bindings.Target;
using Cirrious.MvvmCross.Binding.Interfaces;
using Cirrious.MvvmCross.Interfaces.Platform.Diagnostics;
namespace Cirrious.MvvmCross.Binding.Android.Target
{
public class MvxAutoCompleteTextViewConstraintTargetBinding : MvxPropertyInfoTargetBinding<MvxBindableAutoCompleteTextView>
@slodge
slodge / Profile.cs
Created May 25, 2012 14:57
Profile dump
using System;
using System.IO;
using System.Reflection;
namespace ProfileDumper
{
[Serializable]
class ProfileDump
{
@slodge
slodge / PlanarYUVLuminanceSource
Created June 13, 2012 21:50
PlanarYUVLuminanceSource - for use with Mono4Android in-app scanning
public class PlanarYUVLuminanceSource : LuminanceSource
{
private readonly sbyte[] yuvData;
private readonly int dataWidth;
private readonly int dataHeight;
private readonly int left;
private readonly int top;
public PlanarYUVLuminanceSource(sbyte[] yuvData,
@slodge
slodge / gist:2927149
Created June 13, 2012 23:33
MonoDroid Preview stuff
sealed class Preview : SurfaceView, ISurfaceHolderCallback, Camera.IPreviewCallback
{
ISurfaceHolder surface_holder;
Camera camera;
private QRCodeReader _reader;
public Preview(Context context)
: base(context)
{
@slodge
slodge / Adapter
Created June 28, 2012 15:23
Change MvxBindableListAdapterWithChangedEvent to pass on NotifyCollectionChangedEventArgs
#region Copyright
// <copyright file="MvxBindableListAdapter.cs" company="Cirrious">
// (c) Copyright Cirrious. http://www.cirrious.com
// This source is subject to the Microsoft Public License (Ms-PL)
// Please see license.txt on http://opensource.org/licenses/ms-pl.html
// All other rights reserved.
// </copyright>
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com
#endregion