Wednesday, December 31, 2003 5:56 PM bart

Happy 2004

Although December 31st is just a simple, normal day for me, I want to wish you all the best for 2004.

Maybe it's some "abnormality of informatic guys" like I am, but let's start the year with a little piece of C# :-):

using System;

 

class Test2004

{

  public static void Main()

  {

    TimeSpan ts = DateTime.Now - new DateTime(2004,1,1);

    int s = (int) ts.TotalSeconds;

    Console.WriteLine((s > 0 ? "Happy 2004!" : "Still " + -s + " seconds till 2004"));

  }

}

Or, to say it with XAML:

<Canvas ID="root" xmlns="http://schemas.microsoft.com/2003/xaml" mlns:def="Definition">
<Button ID="button" Click="Button_Click">Fiesta 2004</Button>
 
<def:Code>
  <![CDATA[
 
    void Button_Click(object sender, ClickEventArgs e)
    {
        TimeSpan ts = DateTime.Now - new DateTime(2004,1,1);

        if (ts.TotalSeconds > 0)
        {
           button.Background = Brushes.Green;
           button.Content = "Happy 2004!";
        }
        else
        {
           button.Background = Brushes.Red;

           button.Content = "Still " + ts.TotalSeconds + " seconds to go";
        }
    }
  ]]>
</def:Code>
</Canvas>

Have a great year with Whidbey, XAML , Yukon, Longhorn, BizTalk 2004, MOM 2004, ... and many others!

?>

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under:

Comments

# re: Happy 2004

Wednesday, December 31, 2003 6:07 PM by bart

And a happy 2004 to you too Bart!