Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / Login
Created January 10, 2016 01:58
Screen Object Pattern Example
namespace Mobile.UITest.Screen
{
public class Login
{
IApp _app = null;
public Login(IApp app)
{
_app = app;
}
@adamped
adamped / Login Email
Created January 10, 2016 01:59
Call Screen Object
[Test]
public void CheckEmail()
{
var screen = new Screen.Login(app);
Assert.AreEqual("[email protected]", screen.GetEmailText());
}
public string GetPlatform()
{
var path = "unknown";
#if WINDOWS_PHONE
path = "windowsphone";
#else
#if __SILVERLIGHT__
@adamped
adamped / Toast Notifier
Created January 25, 2016 00:45
Toast Notifier Example Usage
var notificator = DependencyService.Get<IToastNotificator>();
bool tapped = await notificator.Notify(ToastNotificationType.Info, "Title", "Description", TimeSpan.FromSeconds(2));
public class PressedGestureRecognizer : Element, IGestureRecognizer
{
public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PressedGestureRecognizer), (object)null, BindingMode.OneWay, (BindableProperty.ValidateValueDelegate)null, (BindableProperty.BindingPropertyChangedDelegate)null, (BindableProperty.BindingPropertyChangingDelegate)null, (BindableProperty.CoerceValueDelegate)null, (BindableProperty.CreateDefaultValueDelegate)null);
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PressedGestureRecognizer), (object)null, BindingMode.TwoWay, (BindableProperty.ValidateValueDelegate)null, (BindableProperty.BindingPropertyChangedDelegate)null, (BindableProperty.BindingPropertyChangingDelegate)null, (BindableProperty.CoerceValueDelegate)null, (BindableProperty.CreateDefaultValueDelegate)null);
public ICommand Command
{
[assembly: ExportRenderer(typeof(Label), typeof(LabelRender))]
namespace Mobile.UWP.Renderer
{
public class LabelRender : LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
[assembly: ExportRenderer(typeof(Label), typeof(LabelRender))]
namespace Mobile.Droid.Renderer
{
public class LabelRender: LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);