Archive for the ‘WPF-Book’ Category

The Lottery-Console-Application used at the last WPF-Event @ Microsoft Usergroup Switzerland

Monday, August 25th, 2008

Last week we had a great WPF-afterwork-event at Microsoft Usergroup Switzerland (MSUGS) sponsored by Trivadis. I gave a deep-dive session about developing custom controls using WPF with many of it’s features like Dependency Properties, Commands, Routed Events, PART-Elements, Theme-Styles and so on.

At the end of the session a copy of my German WPF-book was drawn. We made a small lottery, but not a normal one. As all attendees were .NET-developers, everyone trusted in .NETs Random-class, so why don’t do it just in code?! We’ve written life a small console-application that did the job for us. As some people asked for the code (of course only the loosers and not the winner of the book ;-) ), here it is:

static void Main(string[] args)
{
  Console.WriteLine();
  Console.WriteLine("  — MSUGS- WPF-Book Lottery");
  Console.WriteLine("  Enter names and a dot (\".\")"
                  + " when names are complete");
  Console.WriteLine();

  List<string> names = new List<string>();
  Console.Write(">");
  string name = Console.ReadLine().Trim();

  while (!name.Equals("."))
  {
    names.Add(name);
    Console.Write(">");
    name = Console.ReadLine().Trim();
  }

  Random random = new Random();
  int winnerIndex = random.Next(names.Count);

  string winner = names[winnerIndex];

  Console.WriteLine();
  Console.WriteLine("Starting lottery…");

  Thread.Sleep(3000);

  Console.Write("And the winner is");

  for (int i = 0; i < 10; i++)
  {
    Thread.Sleep(1000);
    Console.Write(".");
  }
  Console.WriteLine();
  Console.WriteLine();

  Console.WriteLine(winner);

  Console.ReadLine();
}

The Console-Application looks like this:

image

The lucky winner at the MSUGS-event was Stefan, he was at index zero in the names-Collection. Congratulations!

st_msugs_080820

Thanks to MSUGS for the great organization and to all developers who attended in the session. I hope you enjoyed it.

WPF-book is now available in stores, maybe you win a free one @MSUGS

Monday, June 30th, 2008

Since last week my German WPF-book is available in stores. You find more details about the book and some snippets of chapter 1 and chapter 14 on Galileo Computing. You can order the book on the Galileo Comuting-Website or on amazon.de and other stores.

For any questions about the book, write a comment to this post or use the contact-form of my homepage. If you’ve already got the book, I’m looking forward to your feedback.

What’s going on next:

Free MSUGS-Event about developing Custom Controls with the chance to win a WPF-book:
On Wednesday, 20th August, you can visit a free event in cooperation with the Microsoft User Group Switzerland (MSUGS) about developing Custom Controls with WPF. The event will be in Zurich @Trivadis (Europastrasse 5). You find more details about the event here. At the end of this event, you can win one WPF-Book for free.

WPF-Course @Trivadis:
If you want to know more things about WPF-Programming, take a look at the 3-day WPF-course at Trivadis, which you find here. If you take this course, you’ll get a WPF-book, the Trivadis course-material, and everything you need to become a rich & famous WPF-Programmer. ;-)

DataAccess in the time of LINQ:
Christoph Pletz and I are working on a TechnoCircle - a one day event you can visit in the second half of this year @Trivadis - about DataAccess in the time of LINQ. This TechnoCircle does not only show you how LINQ works, it shows how to implement a Data Access Layer in the time of LINQ in a Three-Layer-Architecture. It also discusses the usage of LINQ to SQL vs. Entity Framework vs. DataSets etc. As soon as you can register for the TechnoCircle, you’ll find more infos on the Trivadis-website and of course here on my blog…