Creating Android Apps using C# and Xamarin

You can create native Android and iOS applications using C#, with Xamarin. I explored the capabilities of Xamarin tools and the development experience with Xamarin to create an Android version of CensusMapper. CensusMapper displays U.S. Census data on a Map. I created the original application for Windows 8 (WinRT) using C#. I have since converted it to an MVVM (C#) application, HTML/Javascript (WinJS) version and more recently to a Universal Windows App running on Windows Phone 8.1 and Windows 8.1. In that tradition, now it is faithfully ported to run on Android devices, using C# and Xamarin. CensusMapper is available on Google Play Store. CensusMapper.Android shows population of each U.S. State. User can tap on a location on the map to […]


Using Layer Diagrams – Keeping your MVVM code from turning into spaghetti

Raleigh Code Camp 2013 is wrapping up this afternoon. The venue and the crowd was phenomenal. I really enjoyed presenting “Using Layer Diagrams – Keeping your MVVM code from turning into spaghetti”. Thanks to everyone who attended the presentation. John Sonmez, Our Keynote Speaker, made my day by accepting my request to attend my presentation. It was awesome to have him in the audience and to get feedback from him! I did not get the time to complete the raffle at the end of the presentation. But the folks who won the raffle should be getting an email from me with instructions to download their free license of CodeDemo (Professional). The presentation slides can be downloaded from here : download.    

Understanding and Using System.Transactions

These are some resources to help grasp System.Transactions functionality and use it effectively in your projects: Features Provided by System.Transactions to create transactional applications Implementing an Implicit Transaction using Transaction Scope MSDN Magazine Articles by John Papa: ADO.NET and System.Transactions Revisiting System.Transactions These are specific to TransactionScope (the way to go in most cases): Here is a practical example of Using TransactionScope to handle transactions in .net. This article in MSDN Magazine gets in depth with the way a TransactionScope like functionality can be implemented. Gives you a good understanding of what is happening under the hood when using TransactionScope in some Repository implementations in multi-threaded scenarios. This CodeProject article is another example of implementing a transactional repository. There are […]

Using Model-View-ViewModel in WPF Applications

I am presenting at SoCalCodeCamp this weekend (January 30th, 2010) – Advanced WPF – Using Model-View-ViewModel in WPF Applications. Agenda : 1. Roles of the M-V-VM triad 2. Why use M-V-VM ? 3. Characteristics of the ViewModel 4. Build a Sample WPF Application using M-V-VM Resources : MSDN Magazine Article and Sample Application Download Martin Fowler’s description of the ‘Presentation Model ‘ Jeremy Miller’s ‘Build Your Own CAB’ series

Job Opening – Windows GUI Developer

We have a 3-4 month contract position open for a Windows GUI Developer in our group at Calabasas, California: 2+ years experience developing C++/C# Windows thick-client applications Expert in GUI development on Windows Expert in Object Oriented Analysis and Design (OOA/OOD) Deep understanding of client-server software development Experience in multithreading, and thread synchronization Excellent communication skills (written and verbal) Highly organized and detail oriented BSCS/BSEE or equivalent If you are interested, contact me. The position is available now.

Dial Gauge is a ProgressBar

I am not just being philosophical here. In WPF, ControlTemplates allow you to transform a control’s appearance. This is not the same as applying stylesheets. This is an entirely new level of customization. What you see in the screenshot below looks like a Dial but is actually a simple ProgressBar control wearing a “Dial” template. The Dial template was created using Microsoft Expression Blend . Include the ControlTemplate as a Window.Resource and then assign it to ProgressBar element’s Template attribute : Of course that is not all. The ControlTemplate must define some named elements of FrameworkElement type. Charles Petzold has explained it in detail : MSDN Magazine Article. So, I will not repeat it here. The sample code can be […]

PostSharp with SharpDevelop

SharpDevelop3.0 uses MSBuild. Including PostSharp in your build process is transparent if you are doing a global install using PostSharp installer. If you are doing a per-project installation using “Binary – No Installer” download, you will need to import the PostSharp targets into your .csproj file – True C:\code\PostSharp-\ For more details, read the install instructions included in the PostSharp download and under-the-hood-of-msbuild-integration. To use local PostSharp binaries (relative to your project) , modify your .csproj file as follows – True $(MSBuildProjectDirectory)\PostSharp\ $(MSBuildProjectDirectory) is the directory containing your .csproj file. \PostSharp\ is the directory containing local PostSharp binaries. 2. You will need to exclude the Aspect class itself from being woven. If you are following the getting-started sample, see the […]

Using Custom Converter in XAML

In my previous post : WPF-LINQ To SQL Sample, I had to resort to modifying .dbml file to get the images stored as varbinary into the WPF ListView control. I had to change the Type of image fields to System.Byte[], instead of using System.Data.Linq.Binary. A better way to do this is to use a custom converter. WPF allows you to specify custom converter as part of the Binding in .xaml, like this – <Image Grid.Row=”2″ Source=”{Binding Path=ThumbNailPhoto , Converter={StaticResource imageConverter}}”></Image> The custom converter is declared in the same .xaml file as a resource – <Window.Resources> <local:ImageDataConverter x:Key=”imageConverter” /> </Window.Resources> ImageDataConverter is implemented in .xaml.cs file – public class ImageDataConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, […]

WPF – LINQ to SQL Sample

This exercise in binding a WPF ListView control with LINQ to SQL was a lot of fun ! The following image shows data from AdventureWorks sample database displayed in the ListView control. The end result is very admirable, even in this very basic demo. Feeling a complete sense of freedom is unavoidable when working with WPF. This sample demonstrates : LINQ to SQL mapping. WPF ListView Control DataBinding. Displaying images stored in database as varbinary in WPF control. The sample code can be downloaded here : WPF-LINQ to SQL Sample License : Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

Customize log4net Output Path

The default log4net output path is relative to the startup directory of your executable. To customize the output path, you can override the base Appender’s File property in your own Appender class. The following example describes how to route the log files relative to the temp folder : public class MyOwnAppender : log4net.Appender.RollingFileAppender { public override string File { get { return base.File; } set { if (Path.IsPathRooted(value)) { base.File = value; } else { base.File = Path.Combine(Path.GetTempPath(), value); } } } } Your log4net config file must be modified so that log4net can locate and use your custom Appender. If MyOwnAppender is in MyNamespace and you have implemented it in MyLoggerLib.dll :

Database Schema Version Control Tool

It is essential to treat database schema as source code and apply all the norms and best practices applicable to it. From what I hear and read, database schema version control is non-existent in too many projects. Various techniques to accomplish version control of database schemas have been discussed and published. Martin Fowler and Pramod Sadagale has written a comprehensive article on Evolutionary Database Design. It is a must-read for everyone involved with database development. K. Scott Allen writes in detail about an excellent system here – Versioning Databases – Change Scripts. This approach is sufficiently light-weight (for my taste) and provides complete control over the whole process. I am providing a free tool here that you can use to […]