Skip to content

Instantly share code, notes, and snippets.

@adamped
adamped / MergeStyles
Created January 9, 2016 09:11
Merging Styles from one Resources Dictionary to another
private bool _initialView = true;
protected void LoadStyles()
{
if (!_initialView)
return;
_initialView = false;
@adamped
adamped / Styles
Created January 9, 2016 08:53
Example of style and usage in Xamarin Forms
<Application.Resources>
<ResourceDictionary>
<Style x:Key="BackgroundImageStyle" TargetType="Image">
<Setter Property="Aspect" Value="AspectFill" />
<Setter Property="Source" Value="Background.jpg" />
</Style>
</ResourceDictionary>
</Application.Resources>
@adamped
adamped / SQLite_iOS
Created January 8, 2016 02:17
SQLite for iOS
public class SQLite_iOS : ISQLite
{
private SQLiteConnectionWithLock _conn;
public SQLite_iOS ()
{
}
private string GetDatabasePath ()
{
@adamped
adamped / SQLite_Android
Created January 8, 2016 02:14
SQLite for Android
public class SQLite_Android : ISQLite
{
private SQLiteConnectionWithLock _conn;
public SQLite_Android()
{
}
@adamped
adamped / SQLite_WinPhone
Created January 8, 2016 01:47
SQLite for WinPhone
public class SQLite_WinPhone : ISQLite
{
private static SQLiteConnectionWithLock _conn;
public SQLite_WinPhone() { }
private static Object _connectionLock = new Object();
private string DatabaseName = "DatabaseName.db3";
@adamped
adamped / ISQLite
Created January 8, 2016 01:36
SQLite Interface For Xamarin Forms
public interface ISQLite {
void CloseConnection();
SQLiteAsyncConnection GetAsyncConnection();
void DeleteDatabase();
}
public partial class BindablePicker : Picker
{
public BindablePicker()
{
InitializeComponent();
this.SelectedIndexChanged += OnSelectedIndexChanged;
}
public static BindableProperty ItemsSourceProperty =
var uniqueKey = System.Guid.NewGuid().ToString();
var model = SimpleIoc.Default.GetInstance<LoginModel>(uniqueKey);
// Must remmeber to cleanup, otherwise all new instances are cached
SimpleIoc.Default.Unregister(uniqueKey);
public string Username
{
get
{
return _model.Username;
}
set
{
_model.Username = value;
private LoginModel _model = null;
public LoginModel Model
{
get
{
return _model;
}
set
{
if (value != _model)