Saturday, April 6, 2013

How to Pass Command Line Arguments using Visual Studio ?

How to Pass Command Line Arguments using Visual Studio ?

   Visual Studio enables a nice features where you can do this in the Project Properties window, on the Debug tab. Here is the steps to achieve this
1. Right Click on Project from Solution Explorer and Select Properties.
2. In the Project Properties Windows, Navigate to “Debug Tab”
3. You will Find the a text box “Command Line”
Well, here you can type the command line with separated by Space.


Just write a simple console application to print the command line argument, and put a breakpoint to check the arguments,
So, the each value separated by space has taken has a a command line argument. This will produce below output.


Introduction to Metro UI in Windows8

Introduction to Metro UI in Windows8


As technology progresses, we, being on the eco-system of Microsoft is continuously getting more and more updates in terms of technology, both in pipeline of actual technology update as well as User interface improvements. User Interface plays a key role for any application. Even though how good your application performs, if the application UI is not good, it will definitely get lot less points than it should actually get. In the last decade, the development world continuously shifted its balance towards rich user interface. The inclusion of WPF, Silverlight for web, AJAX,  HTML5, Windows phone applications etc are some of the examples which lets you understand where the world is moving.
Microsoft has been continuously following the trait and introduced a new set of UI’s for us in the new version of Windows released. The very first screen that you see when you open your Windows 8 PC is the Start Screen. The Start screen has been widely changed, there is no Start menu, there are live tiles etc.  Lets take a look at the screen:
So basically you see large number of small boxes in the UI which represents Tiles. These tiles is actually links to an application. The kind of app that it represents are very rich, interactive and secure. The kind of application is what we call metro application.
After you install Metro application, (If you cannot do installation, please follow my blog) you should see Visual Studio 2011 Express tile in your screen. Click on that tile, and you will see our very old desktop (which is represented as tile here in windows 8) to appear.
Create a new Application from the New Dialog box and click ok to create from templates.
It shows there are quite a number of templates available to build Metro style applications. It has support for Javascript in forms of HTML 5 or XAML native applications and .NET Languages. In our case I have chosen SplitApplication which creates an application that layout two columns.  Lets create an application using a template and click run.
You will see the application takes the whole screen area. We dont close a metro application, operating system is responsible for doing the same for us.
So to move back to the desktop either you press Win + Tab or move the mouse on the lower left corner of the screen and click on the charm appears on the screen.
Hence without writing a single line of code, our application is ready. We will look into detail later in the series.





How to use Application Bar in windows 8

How to use Application Bar in windows 8

Application bar is one of the interesting feature for any Metro style applications. Application bar allows you to define standard set of options that your application needs to use at certain context. Metro style applications are generally very clean and does not have any visual portion sharing between toolbars or application options. The app bar is the options that appear dynamically to the user when the user swipe up in the device or use Windows +Z from the keyboard.


Generally we create one application bar for the whole application, but you can also make more than one while developing an application. If you are developing an application with one bar, it is recommended to align it at bottom.
How to add an appbar on your own application
Lets take a look how you can add an appbar into your application. ApplicationBar is inherited from ContentControl, which supports swipe behaviour, also it adds up one control in its child as content. You are allowed to add more than one element as Content using StackPanel or any other panel you want to use.
<ApplicationBar VerticalAlignment="Bottom" DismissMode="LightDismiss">
             <StackPanel Orientation="Horizontal">
              <Button Click="btnStartTracking_Click" />
              <Button Click="btnEndTracking_Click" />
          </StackPanel>
         </ApplicationBar>
Here the applictionbar is added at the bottom of the application which will have two buttons. You need to create a style for these buttons if you wish this to look better. Among many other properties of applicationbar, one of the most important on is DismissMode. DismissMode determines when the application bar is going to dismiss. You can use TimeDelay, to automatically dismiss the appbar after certain amount of time, you can use EdgeSwipe which will dismiss when the application edge is swiped, but the preferred one is LightDismiss. This option will dismiss the applicationbar as soon as the user taps anywhere outside of the application.
I hope the tips comes handy. Stay tune for more.