Improvements in Modules architecture in Sitefinity SP2

Improvements in Modules architecture in Sitefinity SP2

Posted on August 14, 2007 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

For you that have been creating your own modules or simply just playing around with them, here are some good news. It has been a bit awkward in the past when you have tried to get a reference from CommandPanel to ControlPanel and vice versa. Another problematic area used to be notifying one control that other one has done something. Then you needed to created different events and all in all, it was more of a mental exercise than it should of.

So here are the good news. With Service Pack 2 we have introduced two new classes and a slight change in logic that will make all these problems I've mentioned in first paragraph go away. The old way of doing things is however still supported. The two new classes I'm talking about are :
  1. Telerik.Web.ControlPanelBase and
  2. Telerik.Web.CommandPanelBase
Take a look at the following diagram to get a general idea of these new improvements. Later I will explain this in a bit more detail :


New module architecture

So instead of implementing the IControlPanel interface on your ControlPanel classes, you should make that class inherit Telerik.Web.ControlPanelBase and in same way instead of implementing IControlPanelCommand interface on your CommandPanel classes, you should make that class inherit Telerik.Web.CommandPanelBase class.

In addition to that you'll also need to add constructors for ControlPanel and CommandPanel classes.
Here is the constructor for CommandPanel :
public CommandPanel(ControlPanel controlPanel) 
            : base(controlPanel) 
        { 
        } 

and here is the constructor for ControlPanel :
public ControlPanel() 
   base.commandPnls = new ICommandPanel[] { new CommandPanel(this) }; 


notice how the ControlPanel constructor actually creates a new instance of CommandPanel class.

Now in case you are wondering why would you go through all this trouble, here are the reasons.
First of all you'll have a direct access from CommandPanel to ControlPanel and vice versa (this.ControlPanel and this.CommandPanel). Also lets say you do something in CommandPanel (delete something) and you want to refresh the ControlPanel. You don't need to create events for that anymore. All you have to do is call this.ControlPanel.Refresh() from CommandPanel instance. CommandPanel also has the Refresh() method.

I will update the Contacts module in the next post so you can see this new improvements in action.
progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation