Wednesday, December 7, 2016
Daily Links 7 Dec 2016
Ten ways to minimize Azure costs
Free local development using the DocumentDB Emulator plus .NET Core support
.NET Standard 2.0 - Making Sense of .NET Again
Hacking the Xamarin.Forms Layout System for Fun and Profit
Resource Files in Xamarin Forms
Continuous Integration and Continuous Delivery for Xamarin.iOS With VSTS
Azure App Services Continuous Delivery
Introducing Xamarin.Forms 2.3.3: Native View Declaration and Platform Specifics
How Passwordless Authentication Works
Xamarin.Forms: Java.Lang.IllegalStateException
Setting Up Android x86 HAXM Emulators
Thursday, December 1, 2016
Xamarin Forms and the Syncfusion Kanban Control: Getting Started
Xamarin Forms and Syncfusion Xamarin Controls are a great combination to get great looking cross platform native mobile apps while using a mostly shared code base.
In this blog post we’re going to look at getting started with one of the newer controls to the syncfusion xamarin family: The Kanban Control
First and foremost, all the source code for the examples below can be found here
If you’re not familiar with getting a Xamarin Forms app up and running – have a look at the quick start outlines here
Nuget packages for syncfusion controls can be found here – keep in mind you need a license to be able to use them. Luckily if you’re a hobbyist developer or a company with less than five people, you can get a community license which is FREE!
Okay – time to get started.
I’m going to assume you already set up a Xamarin Forms wireframe app – check out the quick start above for details on how to get that up and running.
Usually a new Xamarin Forms project adds Windows Phone variant projects. I tend to stick with UWP only for windows, since this is generally more actively supported by control suites.
To get access to the syncfusion nugets, setup a new nuget package source that points to the syncfusion nuget location.
Add nuget packages for the syncfusion kanban control:
be sure to set the source to the syncfusion xamarin nuget location:
Every project needs to have a reference to the Syncfusion.Xamarin.SfKanban nuget package. You’ll notice there are Android and iOS variants for the package too – these are for the specific Xamarin native platforms (would have been helpful if they actually postfixed the package with “.Forms” – can get a bit confusing as to which package to pick)
Now for some code:
In the portable library, create a ViewModel class to contain all the items that the cards on the kanban control are going to bind to. A sample of the ViewModel class can be found here
The important bits:
You need a class that is the model that each kanban card will represent. Syncfusion provides a default called KanbanModel. We’ll use this for now, but you can use your own model classes too (which I’ll cover in another post). Place an ObservableCollection of this model as a property on the ViewModel class:
…. and then add some items to the collection:
Take note of the Category property, as this is going to be used by the control to know in which swim lane to place the kanban card.
Next, create a page that will host the kanban control – sample can be found here
… and then wire up the BindingContext of the Page to your ViewModel:
.. and then attach categories to each column, so the kanban control knows where to place each item template:
This is done in code behind, but you could just as easily bind these to ViewModel properties in XAML.
Be sure to set the Page to the startup page in the Forms App class:
… and that should be it. Download the source code and give it a test drive.
In my next post I’ll cover:
- Bind cards to custom models
- Creating a custom card template
- Opening up another page when a card gets tapped using a command.
Happy Coding.
Sunday, November 13, 2016
Daily Links 13 Nov 2016
link 1
link 2
link 3
Resilient network services with mobile Xamarin apps
Exploring Application Insights for disconnected or connected deep telemetry in ASP.NET Apps
9 Things You Should Know About SQL Azure Databases
Authorizing your .NET Core MVC Core API requests with OpenIddict and Identity
First Look: Authentication in ASP.NET Core
Xamarin Android 9-Patch Image Splashscreen
Custom Animations in Xamarin Forms
Xamarin Forms Page Templates
Introduction to UrhoSharp in Xamarin Forms
Generate pdf documents using Xamarin Forms and Syncfusion in 5 easy steps
These gaps typically fall into two areas: Platform Services (Camera / GPS / Maps / Settings etc.) and UI Components.
The Xamarin Plugins are a great resource for the former. There are a few resources for the latter, but I have found the Syncfusion Xamarin Control Suite to be the most helpful.
One of the more common needs, of Line of Business apps particularly, is for pdf integration (generating / reading / merging etc.)
The syncfusion xamarin samples seem to be a little sparse, so I thought I’d share an example implementation here.
For more in-depth syncfusion pdf documentation, have a look here. There’s quite a bit more pdf capability that they provide than what is covered here.
This post will cover a basic scenario of generating a pdf document from invoice information using the syncfusion pdf component for Xamarin.
Source code for this post can be found here.
If you’re looking for the detail, check out the github repo – we’ll cover the basic outlines here of what’s necessary.
1. Create context for the pdf generation
In the case of the sample code, I’ve created a GenerateInvoiceContext class – which mostly houses the Invoice from which to generate the pdf from.All the information that you require to generate the pdf needs to be contained in this class.
2. Wrap the generation logic into a command
Create an implementation class that contains the logic for generating the pdf from the invoice. In the sample code, this is the GenerateInvoiceCommand class. I’ve used the command pattern here, because it’s a great way to separate out and force the single responsibility design pattern. The basics for command implementation are provided by the Command Pattern Wireframe nuget package, which provides and ExcuteAsync<TIn, TOut> command pattern to follow. So calling the command from the view model looks something like this:Note that you don’t need to wrap the logic in a command – this is just my personal preference for keeping the code clean.
3. Creating a pdf document
When generating pdf elements, you need to first create the document, and a page for the document before you can start adding elements. I’ve created a PdfGenerator class to make these tasks a little easier. In the Setup method you’ll notice the creation of the document and the first page, as well as common properties for the document to be generated:4. Add elements to the pdf document
Generally, you need to add elements to the pdf document using a top-down approach, keeping track of the Y-position in order to make sure that each element is placed correctly in reference to the previously added element.I found it useful to prefer the methods on the syncfusion pdf component that return a PdfLayoutResult – this helps in creating a reference for where the bounds of the next generated controls needs to be.
5. Save and launch the pdf document
Until now – all the code is shared between all the mobile platforms (iOS / Android / UWP), but saving and launching the pdf document requires platform specific code. In order to call platform code from the shared code, it’s useful to abstract the platform implementation behind an interface – which is then implemented for each platform. I’ve again used the command pattern for ease of use:Now each platform should provide an implementation, which is resolved using Xamarin Forms DependencyService (or you can wire it up using another container service like Autofac)
An example of the android implementation can be found here.
… and a screen grab of the finished product:
Bonus
The xamarin syncfusion components are pretty handy, and in my experience the support I’ve received from them has been exceptional.The best part though, is that all of it is available for FREE – if you’re a single developer or a small business. Check out the community license here.
As someone who has a side project that he hopes to turn into a business one day – it’s these kinds of licensing models which are really helpful – thanks syncfusion!
Tuesday, September 27, 2016
Daily Links 27 Sep 2016
Five ways to avoid a deadlock with async-await
How to easily extend your app using MediatR Notifications
Xamarin University Infrastructure sample code
Prism for Xamarin Forms - Part III: Advanced Navigation
Develop Cloud Connected Mobile Apps with Xamarin and Microsoft Azure
Deep Link Content with Xamarin.Forms URL Navigation
Download Visual Studio Image Library for free
Start Building Azure-Connected Apps with the Xamarin Shopping Demo App
Updating Azure Mobile SQLiteStore to 3.0
15 Must-have Chrome extensions for web designers and front end developer
The Xamarin Show 2: Continuous Integration with Simina Pasat
The Xamarin Show 3: Xamarin.Forms Performance Tips and Tricks
Realities of Cross-Platform Development: How Platform-Specific Can You Go?
Toast Notifications for Xamarin Forms
Monday, August 29, 2016
Daily Links 29 Aug 2016
Extending Azure Logic Apps Using Azure Functions
12 great free Bootstrap themes
Context aware MySQL pools via HAProxy
Introducing the UWP Community Toolkit
Installing gapps in Visual Studio Android Emulator (Marshmallow)
Xamarin.Forms E-Z Print
NGINX for ASP.NET Core In-Depth
Cryptography in Portable Libraries
building web applications with Aurelia and ASP.NET Core
GitHub Extension for Visual Studio 2.0 is now available
XFGloss: Visual Gloss for Xamarin.Forms
Azure Active Directory B2C Overview and Policies Management – Part 1
Beautiful apps made possible and easy with Windows.UI
Using Prism modularization in Xamarin.Forms
YOU'RE USING HTTPCLIENT WRONG AND IT IS DESTABILIZING YOUR SOFTWARE
Monday, August 15, 2016
Daily Links 15 Aug 2016
Xamarin Forms Effects with XAML
Paint.NET Animated Gif Plugin
Sql Server Management Studio now separate product
Material Design Textfield in Android
Cross Platform Animations Using Xamarin Forms
Xamarin - Working with Local Databases in Xamarin.Forms Using SQLite
Offline Apps: what to do when your user disconnects
New visual alerts added to Application Insights metric widget for VSTS dashboards
Demystifying the Microsoft Azure platform
Announcing .NET Framework 4.6.2
.NET Standard Library Support for Xamarin
Aurelia Syncfusion bridge
Creating Animations with Xamarin.Forms
The event queue design pattern
Building Custom Animations in Xamarin.Forms
#Xamarin – #Bluetooth LE plugin version 1.0 (Monkey Robotics finally gets older)
Two tools for quick and easy web application load testing during development
Load and Performance monitoring and analyzing with VSTS and Azure.
Get started with writing TypeScript today!
Interacting with Google Assist in Xamarin
Azure SQL Database Advisor