Skip to content

Instantly share code, notes, and snippets.

View christopherhouse's full-sized avatar
😀

Christopher House christopherhouse

😀
  • Microsoft
  • St. Paul, MN
View GitHub Profile
const string applicationKey = "[your application key goes here";
const string applicationUrl = "[your mobile service url goes here]";
@christopherhouse
christopherhouse / gist:5489078
Created April 30, 2013 14:26
Demonstrates creating an Azure MobileServiceClient instance.
const string applicationKey = "[Insert Your Azure Mobile Service Application Key Here]";
const string applicationUrl = "[Insert Your Azure Mobile Service URL Here]";
private readonly MobileServiceClient client = new MobileServiceClient(applicationUrl, applicationKey);
@christopherhouse
christopherhouse / gist:5489258
Last active December 16, 2015 19:59
ViewDidLoad for WAMSAuthDemo, wires up buttons to login method
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
this.MicrosoftLoginButton.TouchUpInside += (sender, e) => {
this.DoLogin(MobileServiceAuthenticationProvider.MicrosoftAccount);
};
this.FacebookLoginButton.TouchUpInside += (sender, e) => {
private void DoLogin(MobileServiceAuthenticationProvider provider)
{
var task = this.client.LoginAsync(this, provider).ContinueWith(t => {
MobileServiceUser user = t.Result;
this.BeginInvokeOnMainThread(() => {
UIAlertView alert = new UIAlertView("Logged In!", string.Format ("Hello user {0}", user.UserId),
null, "OK");
alert.Show ();
});
using System;
using ThirteenDaysAWeek.TitleAttribute.Models.Attributes;
namespace ThirteenDaysAWeek.TitleAttribute.Models
{
public enum ReportType
{
[ReportTitle(ReportTitle = "Annual Sales Recap", Color = ConsoleColor.DarkGreen)]
AnnualSalesRecap,
[ReportTitle(ReportTitle = "Sales By Region", Color = ConsoleColor.DarkRed)]
namespace ThirteenDaysAWeek.TitleAttribute
{
public static class ReflectionExtensions
{
public static IEnumerable<T> GetCustomAttributes<T>(this Enum enumValue, bool inherit)
{
Type enumType = enumValue.GetType();
string enumValueName = Enum.GetName(enumType, enumValue);
MemberInfo enumMember = enumType.GetMember(enumValueName).First();
using System;
namespace ThirteenDaysAWeek.TitleAttribute.Models.Attributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public class ReportTitleAttribute : Attribute
{
public string ReportTitle { get; set; }
public ConsoleColor Color { get; set; }
using System;
using MonoTouch.MapKit;
using MonoTouch.UIKit;
using System.Drawing;
namespace ThirteenDaysAWeek.MKOverlayView.Views
{
public class MainView : UIView
{
public MainView (RectangleF frame) : base(frame)
private void OnStateSelected(string stateName)
{
if (this.currentStateOverlay != null)
{
this.mainView.MapView.RemoveOverlay(this.currentStateOverlay);
}
State selectedState = this.states.First(state => state.Name == stateName);
this.mainView.MoveMapIntoViewAndPickerOutOfView();
public class MapDelegate : MKMapViewDelegate
{
public override MonoTouch.MapKit.MKOverlayView GetViewForOverlay (MKMapView mapView, NSObject overlay)
{
MKPolygon polygon = overlay as MKPolygon;
MKPolygonView polygonView = new MKPolygonView(polygon);
polygonView.FillColor = UIColor.Purple;
return polygonView;
}