Skip to content

Instantly share code, notes, and snippets.

View davidortinau's full-sized avatar
📱
making something amazing

David Ortinau davidortinau

📱
making something amazing
View GitHub Profile

Rationale

Xamarin Forms introduces VSM, we will now try to extend the features of VSM to be more useful.

  • VSM should make easy to activate states from XAML, for this we could introduce the concept of a StateTrigger, a state trigger activates the attached state depending of a number conditions, we could have builtin AdaptiveTrigger where we activate a state depending on features like screen size or orientation, or a EventStateTrigger that could activate a state when a event is fired and deactivate when other event is fired. We already have this kind of concept and a existing EventTigger and Triggerbase .
    That way the user doesn't have to call the GoToState on code behind. A StateTrigger should only apply when all conditions are met, if any of the conditions isn't met all the modifications to the properties made by the corresponding VisualState are automatically removed and the values provided initally take effect.

  • VSM should support more out of the box states for each of the Views like Bu

using Android.Views;
public int Count = 0;
public void Iterate(View view) {
if (view is ViewGroup)
IterateViewChildren(view);
System.Console.WriteLine($"Total Children {Count}");
}
@foxxjnm
foxxjnm / Blur.cs
Created February 16, 2015 15:58
Xamarin.iOS Image Blur
public static UIImage Blur(this UIImage image, float blurRadius = 25f)
{
if (image != null)
{
// Create a new blurred image.
var imageToBlur = new CIImage (image);
var blur = new CIGaussianBlur ();
blur.Image = imageToBlur;
blur.Radius = blurRadius;
public override void OnActivated (UIApplication application)
{
//When your app is backgrounded, iOS takes a snapshot.
//When the app comes back from the background it shows this snapshot at launch until your app is ready
//Sometimes apple forgets to remove the splash screen.
//Your app is in the forground and working. To prove it you can rotate, and see half your real screen.
//To prevent this from happening you can manually remove the view
foreach (var w in application.Windows) {
if (w != null && w != window) {
@benbishop
benbishop / IOSResourceManager
Last active December 21, 2015 02:09
A simple way to reuse your Strings.xml file from your Xamarin.Android app in Xamarin.IOS. To use, this all you have to do is include the Strings.xml file in the root of your project as a Bundle Resource.
public static class ResourceManager
{
static XDocument stringsDoc;
static XDocument integersDoc;
static ResourceManager ()
{
stringsDoc = XDocument.Load ("Strings.xml");
integersDoc = XDocument.Load ("Integers.xml");
@fwextensions
fwextensions / gist:2713933
Created May 16, 2012 21:04
dojo in FW JS
// embed a local copy of the dojo JSON library, which has been changed
// to not depend on any other part of dojo. that way, we don't have to
// rely on external libraries. unlike Crockford's library, the dojo
// implementation doesn't change the prototypes of basic types, which
// caused problems for the Path panel, and possibly others.
var dojo = {};
dojo.fromJson = function(/*String*/ json){
return eval("(" + json + ")"); // Object
}
@andypiper
andypiper / nuget.sh
Created May 8, 2012 16:18
nuget for OS X
#!/bin/sh
# add a simple 'nuget' command to Mac OS X under Mono
# get NuGet.exe binary from http://nuget.codeplex.com/releases/view/58939
# get Microsoft.Build.dll from a Windows .NET 4.0 installation
# copy to /usr/local/bin and Robert is your father's brother....
#
PATH=/usr/local/bin:$PATH
mono --runtime=v4.0 /usr/local/bin/NuGet.exe $*
// someResponse.amf3 is a data file saved from Charles, ServiceCapture, etc.
// embedded in a class for easy access
[Embed( source="data/someResponse.amf3", mimeType="application/octet-stream" )]
public static const savedCallResponse:Class;