February 2006 - Posts

Free VS.NET 2005 like docking including tabbed MDI
Tue, Feb 28 2006 7:48 PM

All kinds of Third party controls exists to make a tabbed MDI possible.

But (Dutch as I am) was looking for a good looking, free alternative.
I came across DockPanel suite.

Dockpanel suite is much more than a tabbed MDI only .
it's possible to dock panels exactly like in VS.NET 2005. (with the nice looking, user friendly navigation)
Well a picture tells a thousand words:

Weifen Luo has written this open source suite. Version 1.0 is just released which runs on both .NET 1.1 and .NET 2.0.
The source and binaries includes an example application (The screenshot above is taken from the example app)
An extensive cookbook is available for download too (VB.NET version) in a seperate download.

check it out here

Generic ASP.NET 2.0 IExtenderProvider: Solution
Tue, Feb 21 2006 10:35 PM


A couple of months back, in my spare time, I was working on an ASP.NET IExtenderProvider for .NET 2.0 (Think it was in with the september CTP)

Found some articles on codeproject about the subject:
http://www.codeproject.com/aspnet/FixingIExtenderProvider.asp by Wouter van Vugt
http://www.codeproject.com/aspnet/ExtenderProviderComponent.asp by Frank Robijn

But I made it work with the DefaultButton Control of Andy Smith as an ulimate example.

A lot of code was needed to make an ASP.NET IExtenderProvider so i tried to make a Generic base class to make it easier to implement an ASP.NET IExtenderProvider.
Actually I like the amount of code needed in Windows Forms, so tried to achief that. Unfortunately I could not make the Generic version work...

This week I needed an ASP.NET IExtenderProvider again. Found the sources from my project of last year and I was suprised to see it is working with the RTM of VS.NET and a little change in the code.

In the mean time I read Nikhil Kothari's weblog about the Atlas ExtenderControl.
The Atlas version has almost the same functionality as my version has, but it supports renaming and deleting controls from a webform.
The Atlas version is not suitable to work with standard ASP.NET, so with a little effort I added the missing functionality in my Generic version too.
Besides this I renamed my classes so they match the Atlas ExtenderControl.

The ExtenderControl I made is based on the DefaultButton Controls of Andy Smith. The Atlas version has a quite different solution.
The Designer is the IExtenderControl in stead of the ExtenderControl itself for example. Because of this no custom Designer is needed when you use my ExtenderControl.

Anyway, now you can make an ASP.NET 2.0 IExtenderProvider with a minimal effort.
When making a IExtenderProvider yourself you have to follow the next 2 steps:

Step 1: Defining the Extender properties :

    9 public class ValidationProperties : TargetControlProperties

   10     {

   11         [NotifyParentProperty(true)]

   12         public bool ValidationEnabled

   13         {

   14             get

   15             {

   16                 object savedState = (ViewState["ValidationEnabled"]);

   17                 return (savedState == null) ? false : (bool)savedState;

   18             }

   19             set

   20             {

   21                 ViewState["ValidationEnabled"] = value;

   22             }

   23         }

   24     }

 

Step 2: Implement the Extender Control:

   17  [

   18     ProvideProperty("ValidationEnabled", typeof(Control)), // Names the Property to show on other controls in the designer

   19       Designer(typeof(ExtenderControlDesigner<ValidationProperties>))

   20     ]

   21     public class ValidationProvider : ExtenderControl<ValidationProperties>

   22     {

   23         /// <summary>

   24         /// Defines the controls which can be extended.

   25         /// </summary>

   26         /// <remarks>

   27         /// In general, the Page, the Form, and buttons cannot be extended.

   28         /// </remarks>

   29         public override Boolean CanExtend(Object target)

   30         {

   31             if (target is Control && !(target is ValidationProvider))

   32             {

   33                 return true;

   34             }

   35             return false;

   36         }

   37 

   38         /// <summary>

   39         /// gets the property value for the given control

   40         /// </summary>       

   41         public bool GetValidationEnabled(Control control)

   42         {

   43             return EnsureControlItem(control).ValidationEnabled;           

   44         }

   45 

   46         /// <summary>

   47         /// sets the property value for the given control

   48         /// </summary>

   49         public void SetValidationEnabled(Control control, bool validationEnabled)

   50         {

   51             EnsureControlItem(control).ValidationEnabled = validationEnabled;           

   52             NotifyDesignerOfChange();

   53         }

   54 

   55         private ValidationProperties EnsureControlItem(Control control)

   56         {

   57             if (control == null)

   58             {

   59                 throw new ArgumentNullException("control");

   60             }

   61             ValidationProperties item;

   62 

   63             if (this.TargetProperties.Contains(control.ID))

   64                 item = this.TargetProperties[control.ID];

   65             else

   66             {

   67                 item = new ValidationProperties();

   68                 item.ControlId = control.ID;

   69                 this.TargetProperties.Add(item);

   70             }

   71             return item;

   72         }   

   73     }


This looks a lot like the amount of code needed to make an IExtenderProvider in Windows Forms.


Download the full source here (you have to add a webproject yourself)

I have to add a disclaimer for the use of this source because this control is not being tested thoroughly or even used till now, it can contain serious bugs!
I didn't even added XML documentation and such. (shame on me) .


The source contains a solution with 2 projects:
Naber.Web.UI                   Contains the base classes to use when making an IExtenderProvider
Naber.Web.UI.Controls      An example ASP.NET Provider using the Generic baseclasses

 

Let me know what you think about this.


 

 

 

 

 

by Pascal Naber | 2 comment(s)
Filed under:
Lego Mindstorms NXT
Thu, Feb 16 2006 10:40 AM

This year, in august, Lego comes with a complete update of their Mindstorms set. Called Mindstorms NXT.

Long time ago, when I was a little kid (2 weeks ago ;-) ), I used to play a lot with Lego. But I've never played with Mindstorms.
I think it's great,so I know what to ask for christmas already ;-)

It's possible to preorder here:  for 299 Euro !

We will see if the .NET Lego community comes with support for this NXT version.

The next generation of robots!

Create the smartest, strongest and most advanced LEGO® robot ever, in as few as 30 minutes! The new NXT Intelligent Brick, your robot's "brain," features a powerful 32-bit microprocessor and more memory, plus support for USB 2.0, Bluetooth and more!

A highly versatile palette of LEGO TECHNIC® elements combines with state-of-the-art ultrasonic, sound, light and touch sensors in the next generation of intuitive robotics. With the included Quick-Start guide, easy-to-use software and step-by-step building instructions, beginners and experts alike can create humanoid, vehicle and animal robots that obey every command!

Improved light sensors can detect different colors and intensities, while the new sound sensor enables robots to respond to sound patterns and tones. Robots can really "feel" with improved touch sensors, while ultrasonic "eyes" measure distance and movement.

Programming software is now available for both PC and Macintosh, plus with Bluetooth support, you can even command your robot from your mobile phone!

LEGO® MINDSTORMS® NXT Includes:

  • All-new NXT Intelligent Brick with 32-bit microprocessor, more memory and FLASH
  • 3 Interactive Servo motors feature built-in rotation sensors to align speed for precise control
  • New sound sensor reacts to sound commands, patterns and tones
  • New ultrasonic visual sensor responds to movement
  • Improved touch sensor reacts to touch and release
  • Improved light sensor detects different colors and light intensities
  • 519 specially selected LEGO TECHNIC elements for sturdy and durable building and improved functionality and movement
  • 4 input ports, 3 output ports and 7 6-wire cords
  • Matrix display
  • Piezo speakers
  • USB 2.0 and Bluetooth support
  • Easy-to-use PC and Mac compatible interface
  • Intuitive, icon-based drag-and-drop program "building" environment