Feeds:
Posts
Comments

Posts Tagged ‘vs 2010’


[tweetmeme  source=”aabdulmoniem” only_single=false]

I have just finished “Beginning Silverlight 4 in C#” book written by Robert Lair from Apress and I would like to share my humble opinion about it.

Really and simply, it is a great book to grasp many concepts about Silverlight 4 in a just 400 papers. For me, I have finished the book in four days (3-5 hours / day) and of course there are some reasons for that, a couple of them are:

  1. I am not so beginner in this technology as I have used WPF before so I didn’t need any time to grasp multiple concepts quickly.
  2. I need to finish this book as quickly as possible to wrap most of the features and abilities of the new version of Silverlight. In fact my team is going to develop a business application using Silverlight and I was in real need to see the full picture of this technology.

Enough talking about myself, let’s talk about the book.

This book talks about:

  • Why we need Silverlight and how it fits in the RIAs? Really a good and brief introduction gives the reader why he is gonna read about such a new technology.
  • VS 2010 new features and how it supports Silverlight 4 and what you need to get started. BTW, there are some posts here in my blog about the new features of VS 2010 you can find it in “Cutting Edge” column.
  • Layout management in Silverlight. It mentioned some of layout controls and how you can use it to layout your applications like the Grid, WrapPanel, DockPanel, Canvas, and StackPanel.
  • Some of Silverlight controls and some basic examples about them like TextBox, Button, TextBlock … etc.
  • List controls like DataGrid and ListBox besides data binding mechanisms which is so so powerful in the world of XAML.
  • Silverlight toolkit, and what it contains.
  • How you can get access to data in Silverlight (WCF is recommended approach), how you can use Sockets for data access and network communications.
  • Navigation framework which is so similar to master pages and content place holders in ASP.NET. Also, how you can pass data between different pages, how you can map the URIs, and How you can route the URIs to custom ones.
  • Isolated storage and how you can use it for caching purposes, saving and retrieving files … etc.
  • Accessing computer devices like web cam and microphone from a Silverlight application easily.
  • Expression blend introduction and how it fits in the world of Silverlight.
  • How you can style your application in a very similar way to CSS in HTML pages.
  • How to animate objects easily and how to use Expression Blend for this purpose with some basic and nice examples.
  • How to create custom controls, although the book didn’t mention how to create user controls. It gives a very good example for building a custom control from scratch.
  • How Printing is so easy in Silverlight. You can print the screen as it is, or you can even customize the printable data to select portions of screen or even a whole new shape.
  • Finally, it talks briefly about important concepts and ideas you will need when you need to deploy a Silverlight application. It gives an idea about assembly cashing, out-of-browser mode, and elevated trust.

Really, I am recommending this book to any one who needs really to know what is the Silverlight about and what can do.

Thank you Apress for not wasting my time 🙂

    Read Full Post »


    [tweetmeme  source=”aabdulmoniem” only_single=false]

    The VS 2010 debugger has a some great new capabilities like Intellitrace (historical debugging), the new parallel/multithreaded debugging capabilities, and dump debugging support.

    For now we will demonstrate some new tiny usability improvements in VS debugger.

    1 – Break Points Labels

    Suppose that we have a windows application with one form and two buttons on it. We have also two click event handlers and a constructor. Then we added three break points one in the constructor and one in each click handler.

    Open the break points window from Debug -> Windows -> Breakpoints. You will see the following:

    As we can see, we can’t distinguish these three break points from each other by just looking into the break points window. VS 2010 comes with a new capability “Breakpoints Labels” which allows you to attach label/labels to each break point. See the following steps:

    1) Right-click on any breakpoint

    1) Right-click on any break point

    2) Add label

    2) Add label

    3) See the new labels attached to the breakpoints

    3) See the new labels attached to the break points

    Filtering and Searching by labels:

    Enable/Disable break points by label:

    This gives you an advantage to disable some break points you don’t want to break while debugging which share some common label (behavior, position … etc).

    2 – Import / Export break points

    This capability allows you to import/export break points to XML files to share them with another team member or to attach them in a bug work item in TFS for example.

    3 – Pinned Data Tips

    Using this feature, VS 2010 allows you to better track values while you are in debugging session or even you are not.

    I will just enter a debugging session, and just hover over any variable I want to track.

    You can pin this value for later tracking, also you can add some comments, and for sure you can un-pin it at any time:

    We can also Import / Export these data tips as the breakpoint for later share:

    One great feature, is that you have the ability to see what is the last value of a specific variable in the last debugging session even if you are not in a debugging session! WOW! Close the debugging session, and look at the screen shot:

    That’s it. I think that VS has added some very great capabilities to its powerful debugger. Happy debugging!

    Read Full Post »


    [tweetmeme source=”aabdulmoniem” only_single=false]

    Old versions of VS like 2008 was really painful when trying to navigate from an interface method to its implementation. Now, as we have seen a lot of improvements in navigability in VS 2010, we have been introduced with a very cool new window called: “Call Hierarchy”.

    Only you have to right-click on any name you want to trace its call hierarchy and click on “View Call Hierarchy” like the following screen shot:

    VS 2010 will handle the rest. It will open a new dockable window for you titled: “Call Hierarchy”

    Lets examine some features of this window:

    1 – Calls to and Calls from:

    As you can see, you can investigate all the called paths from the chosen method or all the called paths to the chosen method.

    2 – Call sites

    You can click on any call path from the left side of the window to see all the call sites on the right window plus you can navigate to the chosen call site if you want by double clicking on any call site.

    3 – Navigate to the call from or call to paths:

    You can also navigate to the call path by clicking any code path from the left window.

    4 – Filtering call hierarchy:

    You can filter the call hierarchy by solution, project and document as shown in the following screen shot:

    Now, let’s see more complex scenarios when trying to navigate for virtual or interface methods.

    Suppose that we have a class Employee and Manager both are implementing an interface IHuman and inheriting from a class Person. Let’s see these four types:

    Person class:

    public class Person
    {
         public string Title { get; set; }
         public string FirstName { get; set; }
         public string LastName { get; set; }
    
         public string FullName
         {
             get
             {
                 return Title + " " + FirstName + " " + LastName;
             }
         }
    
         public Person()
         {
         }
    
         public Person(string title, string firstName, string lastName)
         {
              Title = title;
              FirstName = firstName;
              LastName = lastName;
         }
    
         public virtual void PrintInformation()
         {
              Console.WriteLine(FullName);
         }
    }
    

    IHuman interface:

    public interface IHuman
    {
         void Talk(string talking);
         void Eat(string food);
    }
    

    Employee class:

    public class Employee : Person, IHuman
    {
         public string Salary { get; set; }
    
         #region IHuman Members
    
          public void Talk(string talking)
          {
               Console.WriteLine("I am saying: " + talking);
          }
    
          public void Eat(string food)
          {
               Console.WriteLine("I am eating: " + food);
          }
    
          #endregion
    
          public override void PrintInformation()
          {
               base.PrintInformation();
               Console.WriteLine(Salary);
          }
    }
    

    And Manager class:

    public class Manager : Person, IHuman
    {
         public string DepartmentName { get; set; }
    
         #region IHuman Members
    
         public void Talk(string talking)
         {
              Console.WriteLine("I am saying: " + talking);
         }
    
         public void Eat(string food)
         {
             Console.WriteLine("I am eating: " + food);
         }
    
         #endregion
    
         public override void PrintInformation()
         {
              base.PrintInformation();
              Console.WriteLine(DepartmentName);
         }
    }
    

    As you can see that Employee and Manager classes override the PrintInformation method which is a Person virtual method. Also, they implement the two methods Talk and Eat of IHuman interface.

    Now let’s play with the call hierarchy feature from the Person class. Right-click on the PrintInformation method in the Person class and choose the “View Call Hierarchy” menu item. See the next screen shot:

    As you can see, we can navigate to all the overrides from this window very easily and forgetting about the hassle of Find or Find All References!

    Let’s switch to the IHuman interface and see what is the call hierarchy of the Talk method:

    Really, pretty neat!

    Read Full Post »


    [tweetmeme source=”aabdulmoniem” only_single=false]

    Update:
    Box selection is one of the old features of the VS but it was only supporting you in VS 2008 with deleting or either copying this text.

    ScottGu said:

    Box selection is a feature that has been in Visual Studio for awhile (although not many people knew about it).  It allows you to select a rectangular region of text within the code editor by holding down the Alt key while selecting the text region with the mouse.  With VS 2008 you could then copy or delete the selected text.

    VS 2010 now enables several more capabilities with box selection including:

    • Text Insertion: Typing with box selection now allows you to insert new text into every selected line.
    • Paste/Replace: You can now paste the contents of one box selection into another and have the content flow correctly.
    • Zero-Length Boxes: You can now make a vertical selection zero characters wide to create a multi-line insert point for new or copied text.

    All you have to do is to click on ALT key + left mouse button and then drag. What will you see?

    As you can see there is light blue box is drawn as long as you drag. This box represents as a boundary to some text in the code file. You can then do whatever you want with this selection either to copy it for example or even delete it.

    Let’s see more appropriate example. What if I have some public variables and I want to make them all private.

    The old way to make this, is to go line by line and change public to private but if I have 10 lines, or may be 100, or even 1000?! This is really a consuming task.

    Here is the box selection comes to the rescue. See the next screen shots:

    Step 1: Select the public keywords (ALT + Left Mouse Button + Drag)

    Step 2: Type private and see what will happen?

    After completion!

    Read Full Post »


    [tweetmeme source=”aabdulmoniem” only_single=false]

    Older versions of VS like 2003 and 2005 were dedicated to only one framework. This was annoying because you have to use multiple versions of VS to develop multi-target applications which wasn’t very feasible at this time!

    VS 2008 had come with a great feature called Multi-Target support which enables developers to develop multi-target applications on the same IDE.  So, I can develop a program under .NET 2.0 and using the same VS to develop another one with .NET 3.5 or even convert the old one to .NET 3.5. Great feature, huh!

    The problem was that all these versions will run on the same CLR, they are only different in class libraries! So, VS 2008 was primarily focused on filtering the different assemblies and project templates according the developer’s framework choice but everything else was working on the same CLR like compiling and debugging for example.

    This wasn’t perfect because the intellisense of VS 2008 always showing the libraries of .NET 3.5 even if you are using .NET 2.0! This makes the chance that developers using .NET 2.0 adding code snippets which is supported only in .NET 3.5 by accident.

    VS 2010 comes to the rescue. Now you can develop many programs under many different frameworks safely because the intellisense has been improved to show only what your framework supports.

    Enough talking let’s see some screen shots. Just I will create two different web applications targeting different frameworks. The first one will target .NET 2.0:

    And the second one will target .NET 4.0:

    Now we have two web applications in our Solution Explorer:

    Now let’s examine some differences, as we see DotNet2 project is the startup one so we will just run the page and open the integrated server information of VS 2010 to see the following:

    But when we mark DotNet4 project as the startup one and run it you will see a different server information:

    As you saw the difference is a clean separation between old CLR and new CLR. Good shot!

    Let’s see another difference while working with VS Toolbox. We will just open the default page of the DotNet2 web application and open the VS ToolBox data tab to see what the supported controls are in ASP.NET 2.0:

    And for the DotNet4 project, we will a different control list:

    As we can see that VS 2010 now filters the tool box to show different controls according to the targeted .NET framework. Amazing!

    Another one is, the property grid. Let’s see what is the difference. Drag a button on the default page for both projects and let’s see what the property grid will show. In DotNet2 project:

    And for DotNet4 project:

    As we can see, VS 2010 filters the properties which are supported in each framework correctly. Nice!

    Last one, is the Intellisense which we have talked about firstly. Let’s try to write a statement like (Response.Re) in the two projects and let’s see what is the difference. In DotNet2 project:

    And in DotNet4 project:

    As we can see, VS 2010 filters the methods and properties which are supported in the targeted framework automatically for you to prevent to from accidentally writing something not appropriate.

    A very good addition to this new version VS 2010.

    Read Full Post »


    [tweetmeme source=”aabdulmoniem” only_single=false]

    In old editions of VS to find all the references of a specific variable on the same file for example you have to do that:

    Right Click on the variable -> Click on find all references

    Then VS will give you all the references he found within the page or not in a new separate window (Results window).

    Now, with the new theme of VS 2010 which is “Keep the developer into focus”, you can accomplish that scenario only by putting your mouse cursor on top of the required variable and let VS 2010 do it for you out of the box ;). See the next image:

    References Highlighting

    FirstName property is highlighted

    Read Full Post »


    [tweetmeme source=”aabdulmoniem” only_single=false]

    Yesterday, I have asked my IT administrator to install another screen for me with a new screen card supporting dual screens in order to feel the experience of the new Multi-Screen support in VS 2010. Really amazing guys!

    Multi Screen Support

    Multi Screen Support on my Machine

    All you have to do is to undock any window in the VS 2010 and just drag and release to the new screen. This gives you many benefits:

    1. Keep you on focus as you can open the designer and code behind file of a form in the same time.
    2. If you were pairing with your colleague and you want to do something while he is reviewing some code on another screen you can do it easily.

    Really, a very good and useful feature in the new IDE.

    Read Full Post »

    Older Posts »

    %d bloggers like this: