Skip to content

Instantly share code, notes, and snippets.

@slodge
slodge / MvxBindableLinearLayout.cs
Created June 28, 2012 17:42
First attempt at more efficient databound LinearLayout...
#region Copyright
// <copyright file="MvxBindableLinearLayout.cs" company="Cirrious">
// (c) Copyright Cirrious. http://www.cirrious.com
// This source is subject to the Microsoft Public License (Ms-PL)
// Please see license.txt on http://opensource.org/licenses/ms-pl.html
// All other rights reserved.
// </copyright>
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com
#endregion
@slodge
slodge / CommunitySqlite3.cs
Created October 9, 2012 08:23
Portable sqlite-net - please note license from "Krueger Systems, Inc."
using System;
using Community.CsharpSqlite;
namespace Tasky.DL.SQLite
{
public class CommunitySqlite3 : SQLite3
{
public static void EnsureInitialised()
{
if (SQLite3.Instance == null)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@slodge
slodge / Interface.cs
Created November 9, 2012 06:19
Non-Portable Azure Mobile Services
using System;
using System.Collections.Generic;
namespace SixSteps.Core.Interfaces.Speakers
{
public interface ISpeakerService
{
void GetSpeakers(string key, Action<List<Speaker>> onSuccess, Action<SpeakerServiceError> onError);
}
}
@slodge
slodge / gist:4054644
Created November 11, 2012 11:35
SSL workaround
// this code is a workaround for:
// "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
// - this error caused by Nike not having a valid certificate now!
ServicePointManager.ServerCertificateValidationCallback = delegate
(object sender,
System.Security.Cryptography.X509Certificates.X509Certificate pCertificate,
System.Security.Cryptography.X509Certificates.X509Chain pChain,
System.Net.Security.SslPolicyErrors pSSLPolicyErrors)
{
//if (pSSLPolicyErrors == System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch && pCertificate.Issuer == "CN=Entrust Certification Authority - L1C, OU=\"(c) 2009 Entrust, Inc.\", OU=www.entrust.net/rpa is incorporated by reference, O=\"Entrust, Inc.\", C=US")
@slodge
slodge / gist:4056221
Created November 11, 2012 20:51
Example ViewModel Binding Description (will change!)
public ElementDescription DefaultView()
{
var auto = new RootAuto(caption: "TestRootElement")
{
new SectionAuto(header: "Customer Info")
{
new StringAuto(caption: "ID", bindingExpression: () => Customer.ID),
new StringAuto(caption: "Name", bindingExpression: () => Customer.Name),
new StringAuto(caption: "Website",
bindingExpression: () => Customer.Website,
@slodge
slodge / gist:4072051
Created November 14, 2012 13:25
List AutoView
private KeyedDescription GetMenuAutoView()
{
var auto = new ParentMenuAuto()
{
new MenuAuto(caption: "New",
longCaption: "New Customer",
icon: "ic_menu_add",
command: () => AddCommand),
};
@slodge
slodge / Flurry MonoDroid JNI Client
Created November 14, 2012 17:03 — forked from mlegris/Flurry MonoDroid JNI Client
Flurry MonoDroid JNI Client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
@slodge
slodge / Added to MainPage.xaml.cs
Created November 17, 2012 18:45
Speech Recognition for AlphaLabs
private async Task StartRecognizeAsync()
{
var speechRecognizer = new SpeechRecognizer();
speechRecognizer.Grammars.AddGrammarFromList(
"answer",
new string[]
{
"Left", "Right", "Up", "Down", "AlphaLabs", "Centre"
});
@slodge
slodge / gist:4111195
Created November 19, 2012 15:11
Too Long to Tweet
It sounds a bit like what you want might be what Greg's done recently - http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/
For MsgBox...
- For error message boxes, I use - http://slodge.blogspot.co.uk/2012/05/one-pattern-for-error-handling-in.html
- For general popups, there was a very long (too long) answer I wrote at http://stackoverflow.com/questions/11053535/alerts-or-popups-in-mvvmcross
- @AwkwardCoder has some quite humourous comments on Mvvm and confirm MessageBoxes in http://awkwardcoder.blogspot.co.uk/2012/03/showing-message-box-from-viewmodel-in.html - but I don't really like his final solution - I don't like the blocking message calls in his ViewModel
For settings...
- @CheeseBaron did some work https://github.com/Cheesebaron/MvvmCross.SettingsSample
- There's a pattern I've used in a few apps where I use a JSON file with an IApplicationSettings service - it's not in public code at present, except for a very small sample in https://github.com/slodge/MvvmCrossCon