C# archives - .NET Developments

.NET Developments:

C#

May 26 2009   3:44PM GMT

Our readership survey is in!



Posted by: Yuval Shavit
Visual Studio and the .NET Framework, .NET Programming Languages, ASP.NET, C#, VB.NET, Open source, VS 2005 and .NET 2.0, VS 2008 and .NET 3.5

The vast majority of SearchWinDevelopment.com readers are using modern tools, but a significant number of them are also interested in maintaining legacy applications, according to a readership survey conducted by the site.

A preliminary look at the survey reveals that 87% are using Visual Studio 2008 or 2005. About 65% of respondents use one of those versions as their primary IDE.

.NET languages are very popular; legacy code also important

Three quarters of all respondents reported using one of the two main .NET languages, C# and VB.NET; for half of respondents, one of those languages is what they do most of their coding in. C# is the more popular language by a significant (but not overwhelming) margin of 48% to 38%. Legacy code is still important, though. One fifth of readers use C++ and almost a third use VB6 or earlier, although only 15% of all respondents use those older languages as their main programming language.

Interestingly, the “use at all” to “use as primary” stats aren’t symmetric within .NET. As I noted above, 48% of readers use C# and 38% use VB.NET. But while 36% of readers use C# as their primary coding language, only 17% use VB.NET as their primary. That means that 75% of respondents who use C# do so for most of their programming (36 / 48 = .75), but only 45% of VB.NET coders use that language as their primary.

Web development is huge, but not quite cutting edge

Unsurprisingly, Web development is very popular. Just over half of all SearchWinDevelopment.com readers work with ASP.NET. For most of those, Web development is their main responsibility. But despite the Web 2.0 craze, Silverlight isn’t nearly as popular.

Ajax development is strong, but relatively diverse. That is probably due in part to Microsoft changing strategies: although it has its own Ajax framework, the company recently decided to officially back the popular library jQuery and incorporate it into IntelliSense. About 30% of ASP.NET developers use ASP.NET AJAX, 23% use jQuery and 15% use another framework.

What you’re doing, and how you’re doing it

In case you’re wondering how other Windows developers get things done, the top four most popular programming methodologies are waterfall, extreme programming (XP), Agile and Scrum. But about a quarter of you aren’t employing any methodology at all! That could be because almost a third of respondents work in an environment with fewer than five programmers, but it’s still a bit surprising.

And as for what you’re doing, the majority of our survey respondents said that improving performance one of their architectural challenges. That’s to be expected, but what stands out is that that’s the only architectural challenge that a majority of our readers are facing. Almost 60% of our readers listed performance as a challenge their company is facing; the next popular choice, implementing a workflow, weighed in at about 42%.

Those are topics we haven’t covered extremely closely, so that feedback is great to have.

Lastly, it’s clear that many of you are interested in learning new tools and technologies. We asked readers to rank their interest in nine topics, including software-as-a-service and open source software, which Microsoft is warming up to. Most of the topics trended toward “highly interested,” with only scripting languages and grid computing technology trending toward disinterest. That might not bode well for Microsoft’s latest push to promote PHP on Azure.

Look for a more in-depth analysis of the survey in the coming weeks. In the meanwhile, to all of our readers who took the survey, our deep thanks!

Jan 12 2009   2:44PM GMT

Mono brings C# to the iPhone, Wii



Posted by: Yuval Shavit
C#, Mobile applications

Mono is best known as an open source implementation of .NET, but as we mentioned in our coverage of Mono 2.0, the project actually started with just a C# compiler. The idea was that C# is a nice programming language, and it’d be nice if non-Microsoft programmers could use it — with or without the .NET framework.

A lot of Mono’s recent progress has been on the .NET side, but the pure-play C# compiler is still relevant.  Game programmers have used C# to write an iPhone app, Mono’s lead Miguel de Icaza announced on his blog. He followed that entry with another, more complete list of C# iPhone apps. Mono has also been used to write at least one game for the Wii in C#.

This is exciting news. The Windows world is a great place to develop, but as other platforms keep cropping up, it’s becoming harder and harder to ignore everything that doesn’t come from Redmond. The iPhone has made a splash, and gaming consoles have always been huge. Thanks to Mono, programmers can reuse their existing skills — and code base — as they look for broader audiences.


Sep 2 2008   5:14PM GMT

Iterators, Lambda, and LINQ… Oh My!



Posted by: Contributing Bloggers
VS 2008 and .NET 3.5, C#

Since the creation of the .Net Framework, Microsoft has kept the concept of “Type Safe” at the forefront of their design goals.  When 1.1 shipped, the framework had a “generic” collection type called an ArrayList that seemed to break this goal.  Microsoft quickly went above and beyond with the 2.0 framework by adding Generics and Anonymous Methods to the mix.  Anonymous methods coupled with Generics paved the way to Lambda expressions, Extension methods,  and LINQ (Language INtegrated Query).  The topic of this paper is loosely defined as:  The path to understanding Lambda and LINQ.

What came first?

Iterating through a collection with a for-each construct has been around for a long time.  .Net has the capability and in the beginning it was the recommended way of looping through a collections of widgets to find something or count something.  The basic construct is:

        private int CountForEach()
        {
            int count = 0;
            foreach (DLDog Dog in Dogs)
            {
                if (Dog.FoodBrand == “Purina” )
                {
                    count++;
                }
            }
            return count;
        }

Nothing too earth shattering about this.  Assuming we have a collection of 10 dogs and 3 of them use “Purina”, we will return a count of 3.

How would Generics and Anonymous methods change this syntax?  In the .Net 2.0 framework we can simplify the previous code a little as follows:

        private int CountGenericDelegate()
        {
            MyActionCount = 0;
            Dogs.ForEach(MyAction);
            return MyActionCount;
        }

This is a little misleading because we still need to write the delegate method “MyAction” but it does give us some flexibility in that we can pass any method to the ForEach generic method that adheres to the Action<T> prototype which is a predefined delegate in .Net 2.0.  Here is what the MyAction needs to look like in this example:

        private void MyAction(DLDog Dog)
        {
            if (Dog.FoodBrand == “Purina” )
            {
                MyActionCount++;
            }
        }

Another predefined delegate is the Predicate<T> delegate.  This one returns a Boolean based on some condition.  The <T> is typically your List<T> type.  Here is an example that uses the Predicate<T>:

        private List<DLDog> QueryDelegate()
        {
            return Dogs.FindAll(ByTypeAndCost);
        }
        // Predicate<T> typed method for FindAll
        bool ByTypeAndCost(DLDog Dog)
        {
            if (Dog.DogType == “German Sheperd” && Dog.AnnualVet > 1500M)
                return true;
            else
                return false;
        }

Enter .NET 3.5 - SWEEEET!

In .NET 3.5 Microsoft pulled all punches and really exploited the power of delegates, generics, and anonymous methods.  Building on that technology they added extension methods, lambda, and LINQ to the system.  Now our first count example can be simplified as:

        private int CountLambda()
        {
            MyActionCount = 0;
            return Dogs.Count(n => n.FoodBrand == “Purina” );
        }

This syntax is foreign as you can see but after a short explanation it will become very natural.  The “=>” operator is loosely defined as “Goes To”.  Under the covers - the compiler is doing this:

        private int CountLambda()
        {
            this.MyActionCount = 0;
            return this.Dogs.Count<DLDog>(delegate(DLDog n)
            {
                return (n.FoodBrand == “Purina” );
            });
        }

Previous code sample courtesy of “Reflector“…

Lambda is nothing more than syntactic sugar for inline anonymous methods and the .Count method on a generic list is nothing more than an extension method provided by the .Net 3.5 framework to the .Net 2.0’s generic list class.  No smoke and mirrors here!

Now LINQ is another animal but simply exploits everything up to this point and the previous example looks like:

        private int CountLinq()
        {
            var query = from dog in Dogs select dog;
            return query.Count(n => n.FoodBrand == “Purina” );
        }

The query variable is of type IEnumerable<T> and the T in this case is a DLDog object.  The compiler ends up with the following:

        private int CountLinq()
        {
            return this.Dogs.Select<DLDog, DLDog>(
                delegate(DLDog dog)
                {
                    return dog;
                }).Count<DLDog>(
                delegate(DLDog n)
                {
                    return (n.FoodBrand == “Purina” );
                }
                );
        }

Notice the use of the .Select extension method.  The method is defined as:

      public static IEnumerable<TResult> Select<TSource, TResult>(
            this IEnumerable<TSource> source,
            Func<TSource, TResult> selector)

(In the Visual Studio help system… )

So in summary - LINQ is really syntactic sugar for the extension methods provided by the .NET 3.5 framework!  Simple! 
…and SWEEEET!

Send me an email if you want a copy of the source code used for this article.


Apr 11 2008   2:45PM GMT

VC++ gets update, VB6 gets heave



Posted by: Jack Vaughan
Visual Basic, .NET programming downloads, C#

Microsoft development honcho Soma Somasegar reports that a Visual C++ 2008 Feature pack has shipped. In January the pack came out in beta.

MFC components included in the pack allow developers to create applications with the look and feel of Microsoft Office, Visual Studio and Internet Explorer. The VC++ 2008 pack can be downloaded from Microsoft’s Download Center.

That’s the good news. The bad news is VB6 has reached end-of-life status in terms of Microsoft formal support. The company has recently created a webcast explaining what that means, and what avenues are open for application migration.


Mar 24 2008   10:49AM GMT

Anonymous Methods - Elegance or Kludge



Posted by: Contributing Bloggers
General Microsoft news, VS 2005 and .NET 2.0, C#

According to Wikipedia, a kludge (or, alternatively, kluge) is a clumsy or inelegant solution to a problem or difficulty. In engineering, a kludge is a workaround, typically using unrelated parts cobbled together. Especially in computer programs, a kludge is often used to fix an unanticipated problem in an earlier kludge; this is essentially a kind of cruft.

When I first stumbled upon the concept of anonymous methods in C# 2.0 the first thing I thought of was …jeez it’s just another name for GOTO!  I’ve since changed my mind.  Have any of you ever used the Gosub…  Return programming construct from way back in the GW-Basic days?  I’m dating myself but in a former life I had the responsibility of maintaining a servo controller program that ran a servo motor (a DC motor that is capable of moving in programmed increments forward and backward) for a plant that made flour tortillas.  (yes - for Taco Bell no less!)  But I digress.  This particular brand of “Servo Basic” as it was called did not have the ability to address function calls.  It was all done with line numbers.  The program started at 10 and ended at the highest line number.  The only way to program a function in this version of basic was to use the Gosub… Return construct.  For instance “Gosub 100″ would jump to line 100 in the program and start executing code until a “Return” statement was hit then control would return to the line after the calling “Gosub” statement.  It was all very archaic but very versatile when it was all you had. 

Now I tell you that story so I can tell you this one:  I was happily coding one fine day when I encountered a problem that I needed to solve and it occurred to me that a Gosub… Return would be perfect here!  It was a function with lots of values passed in that needed to perform the same processing multiple times but I didn’t want to pass all that data around on the stack.  This, my friends, is the perfect case for an anonymous method.  You can define an anonymous method anywhere inside a function and when you call the method, it has the same scope as the code that defined the method.  The example here uses a SqlDataReader to populate an object.  The reader may or may not have some columns in it.  Since the only way to determine the columns in the reader is to use the GetSchemaTable() function and look at the results, I wrote an anonymous method to perform the search and was able to use the search to check for the existence of the questionable columns. 

Notice the placement of the definition within the function.  It is defined after the definition of the ReaderSchema DataTable.  The executing code in the function has scope at the point of definition and so it “knows” about the DataTable.  The syntax is a little funny but makes sense once you work through it.  The name of the anonymous method is “HasColumn” and can now be called from anywhere in the function after its definition.  It returns a boolean and accepts a string as designated by the delegate it is based upon.

Now I could have simply put the HasColum() in its own function and passed the table in to it along with the column name I’m searching for but then I wouldn’t have this totally cool use of an anonymous method, now would I?  However, the question remains:  elegance or kludge?


Feb 28 2008   4:48PM GMT

VB6 Programmers - What happened to Printer.Print?



Posted by: Contributing Bloggers
VS 2005 and .NET 2.0, VS 2002/2003 and .NET 1.0/1.1, Visual Basic, C#, WinForms

This post goes out to all you VB geeks that are wondering what happened to Printer.Print in VB.  This may be a dated topic but I have a feeling there are a few out there longing for those VB6 days when the printer was always sitting there loyal and waiting.  The VB6 programmer’s best friend.  Well, when you needed to print something anyway.   Once upon a time you could just write a few lines of code and *poof* you created a page of information for your users.  Now you have this PrintDocument thing and PrintDialogs and PrintPreviewDialogs and Graphics objects and the list just goes on and on.

Let me re-introduce you to printing in .NET.  Once you get through the slight grade of the learning curve, you’ll be convinced that .Net printing is better than anything you did with the printer object in VB6.

The task - print a smiley face on a piece of paper.  Lines of code in VB6 - about 6.  Lines of code the .net way - about 22 (but you could consolidate…).

That doesn’t sound like a good trade off.  It seems its easier in VB6.  However - what if you wanted to create a bitmap of the smiley face and then use that bitmap in various places as well as print it here and there?  How many line of code do you need now?

 In VB6 - I have no idea.  You would need to drop down to the API level and call graphics functions against a Device Independent Bitmap device context making sure you clean up after yourself in those places where cleanup is necessary.  Then you would need to save that bitmap to a file and/or have an image control somewhere that you could set using the memory bitmap (again using API calls).  Then perhaps you could print the smiley here and there using some similar printing code.

In .NET - its the same 22 lines of code and you can run those lines of code against any “Device Context” (using API terminology) by simply passing a Graphics object to the code that actually creates the smiley.  You could even create a bitmap object and simply use that bitmap throughout your program without ever getting close to the windows API.
Here are my CreateSmiley functions:

private void DrawSmiley(Graphics g, int Width)
{
  Pen p=new Pen(Color.Black);
  SolidBrush b = new SolidBrush(Color.Black);
  SolidBrush YellowBrush = new SolidBrush(Color.Yellow);
  Point Origin = new Point(0, 0);
  Size HeadSize=new Size(Width,Width);
  Rectangle Container=new Rectangle(Origin, HeadSize);
  Point LeftEye=Origin;
  Point RightEye=Origin;
  Point SmileTopLeft = Origin;
  LeftEye.Offset((int)(HeadSize.Width*.25), (int)(HeadSize.Width*.20));
  RightEye.Offset((int)(HeadSize.Width*.65), (int)(HeadSize.Width*.20));
  SmileTopLeft.Offset((int)(HeadSize.Width *.20), (int)(HeadSize.Width * .40));
  Size SmileSize = new Size((int)(HeadSize.Width*.60), (int)(HeadSize.Width*.40));
  Size EyeSize=new Size((int)(HeadSize.Width * .10),(int)(HeadSize.Width * .10));
  g.FillEllipse(YellowBrush, Container);
  g.DrawEllipse(p, Container);
  g.FillEllipse(b, new Rectangle(LeftEye, EyeSize));
  g.FillEllipse(b, new Rectangle(RightEye, EyeSize));
  g.DrawArc(p, new Rectangle(SmileTopLeft, SmileSize), 180, -180);
  b.Dispose();
  YellowBrush.Dispose();
  p.Dispose();
}

private Bitmap CreateSmiley(int Width)
{
  Bitmap Smiley = new Bitmap(Width, Width);
  Graphics g=Graphics.FromImage(Smiley);
  DrawSmiley(g, Smiley.Width);
  g.Dispose();
  return Smiley;
}

Pretty basic stuff and different than you did in VB6. You have access to all the API stuff without dropping down the the API level. Now as far as printing goes - there are a few objects that need your attention. The PrintDocument, PrintDialog, and PrintPreviewDialog objects. The PrintDocument object is the container for all your drawing methods. It handles paging and rendering of the stuff you are printing. The PrintDialog and PrintPreviewDialog objects manage the actual device you are printing to. The PrintDialog as you may have guessed will print to a printer while the PrintPreviewDialog prints to a preview window.

Here is some code that uses a PrintPreviewDialog and calls the printing methods above:

private void button1_Click(object sender, EventArgs e)
{
  PrintDocument pdoc = new PrintDocument();
  // hook up the event handler for the printpage event
  pdoc.PrintPage += new PrintPageEventHandler(pdoc_PrintPage);
  PrintPreviewDialog pdialog = new PrintPreviewDialog();
  pdialog.Document = pdoc;
  pdialog.ClientSize = new Size(640, 480);
  pdialog.Show();
}
void pdoc_PrintPage(object sender, PrintPageEventArgs e)
{
  Bitmap smiley=CreateSmiley(300);
  e.Graphics.DrawImage(smiley, new Point(150, 150));
  e.HasMorePages = false;
}

The VB.Net code is virtually the same. Just change the declaration variables around, change the curly braces to Sub/End Sub, remove the semi-colons and your 80% done.
This method of printing is easy to hook up and offers a great deal of flexibility but if you want real reporting power - there is no substitute for a good reporting engine such as SQL Server Reporting Services or Business Objects’ Crystal Reports. There are others.  I’m a convert.  I was a Crystal Reports bigot but if you’re using a SQL Server database - you get reporting services for free and I must admit after running SQL RS through its paces - I like it better than Crystal Reports.  That, of course, is my opinion.

mysmiley


Feb 19 2008   12:16PM GMT

WCF Certificates, by example



Posted by: Contributing Bloggers
C#, .NET Web services (Windows Communication Foundation)

We bought into .NET Remoting early and have quite a few products in place that exploit the .NET Remoting lifestyle. Did I say lifestyle?  Yes. It seems that, once you go remoting, you don’t want to go back — that is, until WCF came along.  It is better (and worse) than remoting.  I won’t go into any comparison here but I do want to show an example of using certificate based security to validate a client process because it is pretty cool.  I’m using my standard Dog Pound example — which, someday, may run humane societies everywhere.

The architecture looks like this:

DogPoundSystem

Both applications are WinForms apps.  The DogServer is configured as the “Host” while DogClient is, you guessed it, the client.  My requirement is to fire up DogClient and talk to the server without logging in but I want to be secure in the fact that I’m being authenticated and authorized.  We can do this with WCF using either an http connection or a tcp connection and either using a self-hosted server or utilizing IIS as the host.  My example is self-hosted because, lets face it, we want that control!

Assuming you have some kind of application architecture set up (download the code and you will) you can make a few minor changes to the config files to enable secure communication between client and host.  Our example will not use https for the transport, but, even so, each message will be encrypted using a certificate.  The first thing we need to do is create some certificates. If you have a Windows domain with a domain controller that you control, it’s fairly easy to get the certificate server service up and running on Windows Server 2003.  For the purpose of this article, we’re using the makecert utility that comes with Visual Studio. Do this:

makecert -n "CN=DogBase" -sk DogBaseKey -pe -sr localmachine -sky exchange -ss TRUST -r DogBase.cer
makecert -n "CN=DogServer" -sk DogServerKey -pe -sr localmachine -ss MY -sky exchange -ic DogBase.cer -is TRUST DogServer.cer
makecert -n "CN=DogClient" -sk DogClientKey -pe -sr localmachine -ss MY -sky exchange -ic DogBase.cer -is TRUST DogClient.cer

After you execute the third makecert statement you should see DogClient and DogServer certificates in the personal store of [Local Computer]. Use the mmc certificate snap-in to view your certificates. You may need to copy the certificate from the Enterprise Trust store to the Trusted Root Certification Authorities store before things will work for you. I’m not a certificate guru by any means and getting this little sample running in a repeatable process was not the easiest thing i’ve ever done.

We’re finally ready to test some code.  If you downloaded the code then you have everything you need to perform a test.  If not then you need to modify your configuration files to use certificates and transport security as follows:

Click here to see the client config file

Click here to see the server config file

Click here to download the sample code

Some things to note about using makecert for your certificates:  It is easy to get things set up and it provides a good learning experience for certificates but the certificates created should not be used in a production environment. There are also a few caveats. I had to configure the client and server to use PeerTrust on each other’s certificates instead of the default ChainTrust (see the config files). I believe this is partly because I’m using makecert for my certificates and partly becaues my computer is part of a windows domain. I didn’t have this trouble when using certificates issued by the certificate authority from my domain controller. For similar reasons, I had to set the negotiateServiceCredential to false and supply the service certificate in the client configuration.

In a future post I will dive into Mixed-Mode security where we use https for the transport and encrypt the messages.


Feb 11 2008   12:39PM GMT

TFS to the rescue — almost



Posted by: Contributing Bloggers
VS 2005 and .NET 2.0, Visual Basic, C#, Architecture and the SDLC

(Editor’s note: This is the first blog post by Christopher Yager, who will be writing on the .NET Developments blog from time to time. Yager is chief software architect at GLD Solutions Inc. and is currently using .NET 2.0 for his new development projects. Here he will blog about topics such as Windows Communication Foundation, Team Foundation Server and SQL Server. Welcome aboard, Chris!)

Before I get into this — welcome to my blog.  I’ll be posting mainly about my adventures in .NET programming — feedback is welcome.  I’m no guru but I did stay at a Holiday Inn Express last night.  (Actually as I write I’m still at said Holiday Inn… )

So TFS (Team Foundation Server), Microsoft’s answer to the software lifecycle management problem, really is a great product.  My team uses most features on a daily basis.  My headline is somewhat misleading but allow me some latitude while I state my case.  I run a software development company.  We produce software products and we have customers that use them.  (Go figure.)  We have a QA staff.  We test our products.  TFS has no way to capture the guts of a user defined test against a product that tests a particular requirement.  Specifically we needed to save metrics of test runs with success and failure rates, reasons for failure, environments tested, and lot of other neat stuff.  I didn’t expect TFS to have all this rich user testing goo so I expected we’d roll our own.  This article is about how we connected our hand-rolled testing metrics program with our Team Foundation Server.

The problem:  A scenario test fails; a bug is created against a product/task/whatever and needs to be linked to the test that caused the problem.

The Solution:  The TFS API!

Team Foundation Server has a plethora of components that you can leverage allowing seamless integration with the back end of your TFS implementation.  These components are found in the following path normally: 

[Program Files Root]\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies

**Client requirement: On any system you install your custom TFS linked software, Team Explorer must be installed.  An obvious server requirement is that you have a Team Foundation Server installed somewhere in your network or available via the Web.  If you’re interested in getting TFS running (and why wouldn’t you be?!) you can download a trial from Microsoft.

Our general requirement for this task was to view a list of active bugs for a team project and allow selection of one. 

OK — some meat for you code monkeys. 

Create a windows forms project in your favorite language.  Mine is C# but any .NET language will do.

Add references to the following assemblies.  You’ll need to browse for them since they are not in the GAC or otherwise registered for easy VS reference adding.  The image shows them all together but this is a doctored image to save space.

tfs references

Put a tab control on the form and set it to dock-fill (leave the 2 tab pages alone), size the form to 800X600 (this just saves us some time and coding).

We’re basically going to create two functions that perform the guts of the scenario.  The GetWorkItems function which utilizes the DomainProjectPicker dialog class to allow the user to select the team project they wish to examine and the PickWorkItemsControl user control which allows searching of the TFS work item store. 

                   

private void GetWorkItems()
{
    DomainProjectPicker dpp = new DomainProjectPicker();
    DialogResult dr = dpp.ShowDialog(this);
    if (dr == DialogResult.OK)
    {
        tfs = dpp.SelectedServer;
        tfsProject = dpp.SelectedProjects[0];
        this.Text = "My Team Foundation Link - " + tfsProject.Name;
        Store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
        TeamProject = Store.Projects tfsProject.Name];
        pw = new PickWorkItemsControl(Store);
        pw.Dock = DockStyle.Fill;
        pw.PortfolioDisplayName = TeamProject.Name;
        this.tabPage1.Controls.Add(pw);
        pw.PickWorkItemsListViewDoubleClicked +=
            new PickWorkItemsListViewDoubleClickedEventHandler(
            pw_PickWorkItemsListViewDoubleClicked);
    }
}

The InitWorkItemControl function allows the user to view the details of a selected work item and utilizes the WorkItemFormControl control.


private void InitWorkItemControl()
{
    this.WorkItemControl = new WorkItemFormControl();
    this.WorkItemControl.Dock = System.Windows.Forms.DockStyle.Fill;
    this.WorkItemControl.FormDefinition = null;
    this.WorkItemControl.Item = null;
    this.WorkItemControl.LayoutTargetName = "WinForms";
    this.WorkItemControl.Name = "WorkItemControl";
    this.WorkItemControl.Size = new System.Drawing.Size(683, 428);
    this.WorkItemControl.TabIndex = 0;
    this.tabPage2.Controls.Add(this.WorkItemControl);
} 

We’ll tie this all together in the constructor for the form:


public Form1()
{
    InitializeComponent();
    InitWorkItemControl();
    GetWorkItems();
}

Here is what the finished product looks like: (This is an out-of-the-box dialog,  I didn’t write any of it.)
tfsConnect

The search control on this form does not have any of my code in it.  I only provided the tab control for it to live in.
tfssearch
The dialogs and controls exposed by the TFS API take care of the majority of the user interface, we just need to hook the stuff together with a little glue.  You can download the sample solution which has both C# and VB .NET versions of the program. 

Special thanks to Brian Randell who taught me this stuff through an article on MSDN Magazine.

 Download the source code here


Jan 29 2008   11:03AM GMT

Lang.NET shows Iron Python with Robotics Studio, JScript on DLR



Posted by: Jack Vaughan
Silverlight, C#, Dynamic Languages, ASP.NET

Microsoft’s Lang.NET Symposium 2008 got up and running yesterday. C# father Anders Hejlsberg talked about C# 3.0 features, IronPython guru Hugunin discussed the Dynamic Language Runtime (DLR) and IronPython, and Pratap Lakshman from the JScript team talked about the new managed implementation of JScript, codenamed Managed JScript.

Hejlsberg, as reported by blogger extraordinaire Ted Neward, told the assembled language heads that the conventional divisions of language types (into categories) covering the functional, the object-oriented, and so on will break down in the years ahead.

IronPython high priest Jim Hugunin did a demo that mixed Microsoft Robotics Studio code with IronPython running on the DLR. Hugunin’s creation, IronPython, was recently updated as IronPython RC 1.1.1 on CodePlex.  Hugunin created Jython, a Java version of Python.

IronPython 1.0 was debuted in September 2006. The latest release candidate is described as a minor update focused on bug fixing. Hugunin’s team has fielded IronPython 2.0 Alpha 1, as well. This is the first release of IronPython built on the DLR, and targeting version 2.5 of Python.

For his part, Pratap Lakshman provided an overview of the managed Jscript implementation originally discussed at MIX07.  JavaScript on top of the DLR became a reality as part of Silverlight 2.0 (then known as Silverlight 1.1).

Surprise guests at the symposium were Java specialists John Rose and Charles Nutter, who discussed Java’s increasing support of new languages on the JVM.

Planned Day 2 discussions at Lang.NET 2008 include Eric Meijer on Volta, Paul Vick on Visual Basic and Karl Prosser ”Powershell Plus. ”


Jan 11 2008   12:55PM GMT

MFC library updates for Visual C++



Posted by: Jack Vaughan
C#

A recent downloadable Visual C++ 2008 feature pack beta has power tools covering both the client and server sides of things.

The VC++ 2008 MFC libraries have been extended to help developers work with the Office Ribbon style interface. An updated set of GUI controls has been included and Visual Studio-style docking toolbars and panes are supported.

Meanwhile, the release pack includes an implementation of the TR1 (Technical Report 1) additions to the ISO 2003 standard C++ library. Included are new containers - including tuple, array and unordered sets - polymorphic function wrappers and much more.