Skip to content

Instantly share code, notes, and snippets.

View lbugnion's full-sized avatar

Laurent Bugnion lbugnion

View GitHub Profile
namespace GalaSoft.MvvmLight.Helpers
{
/// <summary>
/// A <see cref="BaseAdapter{T}"/> that can be used with an Android ListView. After setting
/// the <see cref="DataSource"/> and the <see cref="GetTemplate"/> properties, the adapter is
/// suitable for a list control. If the DataSource is an <see cref="INotifyCollectionChanged"/>,
/// changes to the collection will be observed and the UI will automatically be updated.
/// </summary>
/// <typeparam name="T">The type of the items contained in the <see cref="DataSource"/>.</typeparam>
////[ClassInfo(typeof(ObservableAdapter<T>),
<dependencies>
<group targetFramework="net35">
<dependency id="CommonServiceLocator" version="1.0" />
</group>
<group targetFramework="net40">
<dependency id="CommonServiceLocator" version="1.3" />
</group>
<group targetFramework="net45">
<dependency id="CommonServiceLocator" version="1.3" />
</group>
@lbugnion
lbugnion / gist:e8f9557cd255aaf863b5
Created January 27, 2016 20:53
MVVM Light binding framework for Xamarin supports deep paths with changing objects! Passed
[Test]
public void BindingDeepPath_DeepSourceExistingPathChangingObjects_NoError()
{
VmSource = new TestViewModel
{
Nested = new TestViewModel
{
Nested = new TestViewModel
{
Model = new TestModel
@lbugnion
lbugnion / gist:db7789d29136d510549b
Created January 27, 2016 21:04
MVVM Light binding framework for Xamarin also supports FallbackValue and TargetNullValue
[Test]
public void BindingDeepPath_DeepSourceExistingPathGraduallySettingPath_NoError()
{
VmSource = new TestViewModel();
VmTarget = new TestViewModel();
const string fallback = "This is the fallback";
const string targetNull = "Target is null";
var binding = new Helpers.Binding<string, string>(
<Window x:Class="WpfApplication3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication3"
mc:Ignorable="d"
Title="MainWindow"
Height="350"
Width="525"
var client = new HttpClient();
var request = new HttpRequestMessage
{
RequestUri = new Uri(PostTweetUrl),
Method = HttpMethod.Post
};
var json = $"{{\"key\":\"{hash}\",\"twittername\":\"@@LBugnion\"}}";
{
"$connections": {
"value": {
"twitter": {
"connectionId": "/subscriptions/6e69cf24-0859-4dec-84e2-695e2618e473/resourceGroups/swisstechsummit/providers/Microsoft.Web/connections/twitter",
"connectionName": "twitter",
"id": "/subscriptions/6e69cf24-0859-4dec-84e2-695e2618e473/providers/Microsoft.Web/locations/westeurope/managedApis/twitter"
}
}
},
{"key":"b9428987d60ade36f292fa333f63c657","twittername":"@@LBugnion"}
private CustomVisionPredictionClient _endpoint;
// ...
if (_endpoint == null)
{
_endpoint = new CustomVisionPredictionClient
{
ApiKey = App.PredictionKey // PredictionKey copied from the CustomVision.ai project
};
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"prefix": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "A unique prefix in lowercase"
}