About Me

reno, NV, United States
As of 2011, I have ten years experience in various technologies as C#, WPF, Java, J2EE, C++. For the past three years, I have been extensively working on various .net and java technologies including but not limited to WPF , C# , WCF and composite application guidance (Prism ).

Wednesday, November 5, 2008

XBAP and Serial Port

XBAP (XAML Browser Application) is a new Windows technology used for creating Rich Internet Applications. While windows applications are normally compiled to an .exe file, browser applications are compiled to an extension .xbap and can be run inside Internet Explorer.

Xbap applications are run within a security sandbox to prevent untrusted applications from controlling local system resources. (e.g deleting local files)

But If your application requires peripherals access, the user can run an xbap in full trust mode. Here is how you can set up a XBAP application in full trust mode.

Here in this application, the main page just has a Button. When clicked, the eventhandler opens the COM3 port and flushes data.

The following code prints a ticket on the COM3 port.

public void button_click(object sender, RoutedEventArgs e)

System.Text.Encoding enc = System.Text.Encoding.ASCII;
System.Console.WriteLine("Hello world");

// Instantiate the communications // port with some basic settings
SerialPort port = new SerialPort("COM3", 115200, Parity.None, 8, StopBits.One);

// Open the port for communications

ReadFromFile("c:\\Cash_Out_Ticket_Test_Stock_424_200_data.txt", port);

catch (System.UnauthorizedAccessException)
System.Console.WriteLine("Com port occupied. Please choose another port");


Source code here.

Happy coding!
Pradeep Mahdevu


XAML Power Toys

The XAML Power toys are a great help to increase your productivity in day to day development. You can download powertoys here.

Here are some videos where you can see the power of this tool.

XAML Power Toys: Create Business Form

This feature provides developers the necessary tool to layout a Grid, with controls and labels. Use this feature if you are creating a Grid that is not bound to a business entity object...


XAML Power Toys: Build Form For Class

This feature puts the WPF & Silverlight form developer on steroids. This video covers selecting a class and creating a fully bound form effortlessly. When combined with well defined...


XAML Power Toys: Installation and Setup

This is a must view video for all first time users of XAML Power Toys. This video covers installing and configuring security in Visual Studio 2008. Author: Karl Shifflett

~Pradeep Mahdevu



Blogger Syntax Highliter