Skip to content

Instantly share code, notes, and snippets.

John Wilson wislon

Block or report user

Report or block wislon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wislon
wislon / SdkBeforeCleanFix.txt
Last active Aug 28, 2018
Fix '_SdkBeforeClean' build error when building xamarin xplat app
View SdkBeforeCleanFix.txt
It seems to only be a problem on xplat solutions, as they set up a chain of 'clean'-task dependencies,
which apparently other solutions don't.
This is caused by a missing `;` in one of the msbuild `.targets` files as described here
(and is a bug in dotnet core 2.1.3 sdk, and VS 2017 15.8.x):
* https://github.com/onovotny/MSBuildSdkExtras/issues/89
which led to
@wislon
wislon / BluetoothHelper.cs
Created Nov 22, 2017
Android Bluetooth Helper (power up/down adapter, build config based on SDK level etc.)
View BluetoothHelper.cs
public static class BluetoothHelper
{
private static readonly BluetoothManager _manager;
private static readonly BluetoothAdapter _adapter;
static BluetoothHelper()
{
var context = Application.Context;
_manager = (BluetoothManager)context.GetSystemService("bluetooth");
_adapter = _manager.Adapter;
@wislon
wislon / boxstarter01.ps1
Last active Sep 15, 2017
BoxStarter scripts For initial windoze setup
View boxstarter01.ps1
##################
# Blatantly swiped from
# - Nick Craver's gist at https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9
# - Jess Frazelle's at https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f
##################
# To run this locally, do
# Install-BoxstarterPackage -PackageName <this.RAW.gist.url> -DisableReboots
# i.e. Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/wislon/a2a7716fad4dccf58961d1d408d74b89/raw/bdb7f16939800586cef71bd4df7c9596370506ed/boxstarter01.ps1 -DisableReboots
# If you allow reboots, you will likely be prompted for your password so it can reboot/relog in as necessary.
@wislon
wislon / Android Privacy Policy Template
Created Mar 12, 2017 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
View Android Privacy Policy Template
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@wislon
wislon / 1_IPlatformCookieStore.cs
Last active Aug 6, 2018
Xamarin Forms xplat WebView Cookie Demo
View 1_IPlatformCookieStore.cs
using System.Collections.Generic;
using System.Net;
public interface IPlatformCookieStore
{
/// <summary>
/// List of cookies pulled from the cookie storage manager
/// on the device/platform you're on. Can be quite an expensive call,
/// so use it sparingly.
/// </summary>
@wislon
wislon / datatemplate_itemtemplate_xaml_template.md
Last active Sep 25, 2015
Xamarin Forms XAML Dynamic ListView ItemTemplate Selection
View datatemplate_itemtemplate_xaml_template.md

Sample Grid XAML DataTemplate with a Grid layout

Has a basic 5-column, 6-row layout, with padding/spacing columns/rows delineated with coloured boxviews (since gridview cells don't have borders, we can't see where one cell stops and another begins)

Note, to get the design-time intellisense for the DataContext binding, you'll need to add the following namespaces to the top of your XAML file (can go beneath the usual xamarin forms namespaces, order isn't really important):

 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@wislon
wislon / xaml-xcc-info.md
Last active Sep 23, 2015
Xam.Forms XAML conditional compilation& design-time bindings intellisense in VS
View xaml-xcc-info.md

Xam.Forms XAML conditional compilation& design-time bindings intellisense

Original article:

http://adventuresinxamarinforms.com/2015/03/17/xaml-v-code/

add (to each xaml file, near the top with the other xmlns definitions)

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
@wislon
wislon / getcookiesgist.cs
Created Sep 10, 2015
Get Cookies from HTTPClient instance (using CookieContainer, or raw headers)
View getcookiesgist.cs
/// <summary>
/// Will return null if the cookie you were looking for isn't in the container.
/// </summary>
/// <param name="cookieName"></param>
/// <param name="cookieContainer"></param>
/// <returns></returns>
protected async Task<Cookie> ExtractCookieWithName(string cookieName, CookieContainer cookieContainer)
{
var cookies = cookieContainer.GetCookies(new Uri(SharedConstants.WebsiteBaseUrl));
var cookie = cookies[cookieName];
@wislon
wislon / fragment.xml
Last active Apr 26, 2019
Transparent WebView Load Animated Gif (Xamarin Android)
View fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:id="@+id/webLoadingIcon"
android:layout_width="44dp"
@wislon
wislon / ViewExtensions.cs
Last active Aug 29, 2015
Animation code samples
View ViewExtensions.cs
using Android.Content;
using Android.Views;
using Android.Views.Animations;
namespace Mobile.Droid.Extensions
{
// invoke with anyView.BringViewInWithAnimation/TakeViewOutWithAnimation
// where animation param is predefined animations from xml, code, etc.
// e.g. inAnimation = AnimationUtils.LoadAnimation(Activity, Resource.Animation.bottom_slide_in);
You can’t perform that action at this time.