Posts

Showing posts from December, 2016

Use Font Awesome from Xamarin.Android for your Xamarin.Forms project

Image
Use Font Awesome from your Xamarin.Forms project Icons are important in mobile applications where space is limited. We use icon everywhere to convey action intent like + would be to add an item or a bin would be to delete one. There are two ways to add icons to our mobile app: with images with fonts Today we will see the second option - how we can add Font awesome to our Xamarin.Android project and how we can use it from Xamarin.Forms. This post will be composed by three parts: 1. Why Font Awesome 2. Add Font Awesome to the Droid project 3. Use with Xamarin.Forms 1. Why Font Awesome If you are familiar with Web development, you must have encountered Font awesome http://fontawesome.io/ . It is an icon font containing lots of icon for every type of usage. The advantaged of using a font is that we can leverage the text options, like text color or text size, to easily update the style of the icon to match our app. Let’s see how we can bring Font Awesome to the Droid pro

Output logs in Console, File and Live stream for your WebSharper sitelet

Image
Output logs in Console, File and Live stream for your WebSharper sitelet Logs are an important part of development. Extracting and analysing debug output and errors is very important especially when the web server goes live. In this post I will show how we can setup a Console target , a File target and a Live stream on a static HTML page using NLog . NLog is a log framework which can be configured to output logs on different “target”. https://github.com/nlog/NLog/wiki/Targets This post is composed by 4 parts: 1. Get NLog on your sitelet 2. Define a Console target 3. Define a File target 4. Define a Live stream target - WebSharper part 1. Get NLog on your sitelet First start by getting NLog and NLog.Configuration packages from nuget. This will install NLog package in your project and also add an xml configuration nlog.xml file with an xsd. To start logging, simply get the logger instance via let logger = LogManager.GetCurrentClassLogger() and start logging by using any o

GIMP Alpha Channel, what is it?

Image
GIMP - Alpha channel, what is it? Few months ago I made a first introduction to GIMP - https://kimsereyblog.blogspot.co.uk/2016/09/gimps-primary-features.html - the post was oriented toward the toolbox and what features were available. Today I would like to share an explanation on what the alpha channel is and show you how you can outline text using the alpha channel. 1. What is the alpha channel The channels tab can be seen from the Layers view. There are 4 channels, Red, Green, Blue and Alpha. The alpha channel is used for transparency. Transparency means that when you export to .png, the transparent parts of your image will show whatever is underneath. This is very useful for apps icons or images for web design. When your layer does not have an alpha channel, its name should be bolded. When it has one it should not be bolded. Also when right click on the layer, Add alpha channel should be grayed out. Having an alpha channel allows us to add transparency to our image.

Transform an operation from a Xamarin.Android activity to an awaitable task

Image
Transform an operation from a Xamarin.Android activity to an awaitable task Today I want to share a neat trick which I have been using a lot - transform an asynchronous operation (triggered with StartActivityFromResult) from an Android Activity to an awaitable task - which then can be used with async await keywords in a Xamarin.Forms PCL project. Problem CustomPickActivity TaskCompletionSource in service 1. Problem In order to pick a file from the device local storage and execute an action using the selected file, the pick action (StartActivityFromResult/OnActivityResult) must be turned to an awaitable Task. 2. PickActivity To pick a file from our Xamarin.Forms project, we use a service which starts a picker activity. public class FilePicked : EventArgs { public string AbsolutePath { get; set; } } [Activity] public class PickActivity: Activity { static event EventHandler<FilePicked> OnFilePicked; protected override void OnCreate(Bundle savedInstanceState