This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "return" "version" "name" - names aren't syntactically correct (they're probably upper case for starters) | |
// 21 5.0 lollipop | |
// 20 4.4.2W kitkat wear | |
// 19 4.4.2 kitkat | |
// 18 4.3.1 jelly bean mr2 | |
// 17 4.2.2 jelly bean mr1 | |
// 16 4.1.2 jelly bean | |
// 15 4.0.3 ice-cream sandwich mr1 | |
// 14 4.0 ice-cream sandwich | |
// 13 3.2 honeycomb mr2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/10310917/uicolor-from-hex-in-monotouch | |
public static UIColor GetColorFromHexString(string hexValue) { | |
hexValue = hexValue.Substring(1, 6); // string will be passed in with a leading # | |
var r = Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var g = Convert.ToByte(hexValue.Substring(2, 2), 16); | |
var b = Convert.ToByte(hexValue.Substring(4, 2), 16); | |
return UIColor.FromRGB(r, g, b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://social.msdn.microsoft.com/forums/windowsapps/en-us/b639cd8a-30c2-48cf-99be-559f34cbfa79/convert-string-to-color-in-metro | |
public static System.Windows.Media.Color GetColorFromHexString(string hexValue) { | |
hexValue = hexValue.Substring(1, 6); // string will be passed in with a leading # | |
byte a = 0xff;// Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var r = Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var g = Convert.ToByte(hexValue.Substring(2, 2), 16); | |
var b = Convert.ToByte(hexValue.Substring(4, 2), 16); | |
return System.Windows.Media.Color.FromArgb(a, r, g, b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://developer.xamarin.com/recipes/ios/content_controls/map_view/display_a_location/ | |
/// <summary>Converts miles to latitude degrees</summary> | |
public static double MilesToLatitudeDegrees(double miles) { | |
double earthRadius = 3960.0; // in miles | |
double radiansToDegrees = 180.0 / Math.PI; | |
return (miles / earthRadius) * radiansToDegrees; | |
} | |
/// <summary>Converts miles to longitudinal degrees at a specified latitude</summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Xamarin Evolve 2014: Extending Xamarin.Forms with Custom Controls - Jason Smith, Xamarin https://www.youtube.com/watch?v=pIZ8G47KPIM | |
protected async override void OnAppearing() { | |
base.OnAppearing(); | |
var loadingView = new ActivityIndicator { | |
VerticalOptions = LayoutOptions.Center, | |
HorizontalOptions = LayoutOptions.Center, | |
IsRunning = true | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
// from Xamarin Monkey demo - http://motzcod.es/post/93792500152/custom-listview-viewcells-in-xamarin-forms | |
namespace Interact.Core.Helper { | |
public class Grouping<TKey, TValue> : ObservableCollection<TValue> { | |
public TKey Key { get; private set; } | |
public Grouping(TKey key, IEnumerable<TValue> items) { | |
Key = key; | |
foreach (var item in items) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Smart Card PnP | |
# [x86] | |
# [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP] | |
# "EnableScPnP"=dword:00000000 | |
# [64-bit] | |
# HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ScPnP] | |
# "EnableScPnP"=dword:00000000 | |
# this Wow6432Node entry is a "hardlink" to the above entry, so you create/delete/edit that and the changes are mirrored in Wow6432Node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ... { | |
public abstract class BaseViewModel : BindableObject { // yeah its overkill, can't recall why my colleague did it this way | |
private string title = string.Empty; | |
public string Title { | |
get { return title; } | |
set { | |
if(title != value) { | |
title = value; | |
RaisePropertyChanged(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ... { | |
// for supporting this | |
// public partial class "Derived"Page : "Derived"PageXaml {.... } for a xaml/cs page | |
// then | |
// <?xml version="1.0" encoding="utf-8" ?><local:"Derived"tPageXaml xmlns="ht... | |
// with this bit in the cs file | |
// public partial class "Derived"PageXaml : BasePageOverrideBackButton<ViewModel."Derived"ViewModel> { } | |
public class BasePageOverrideBackButton<T> : BasePage<T> where T : ViewModel.BaseViewModel, new() { | |
public BasePageOverrideBackButton() : base() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<derived:BasePage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="....AboutPage" | |
xmlns:local="clr-namespace:...;assembly=..." | |
xmlns:derived="clr-namespace:....View;assembly=..." | |
BindingContext="{x:Static local:App.AboutViewModel}" | |
Title="About"> | |
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> | |
<Label Text="{Binding Detail}"/> |
OlderNewer