Click here to Skip to main content
15,887,746 members
Articles / Programming Languages / C#
Article

Inductive Presentation Framework in C#

Rate me:
Please Sign up or sign in to vote.
2.75/5 (6 votes)
15 Jan 20053 min read 33K   268   16   3
A framework for building inductive user interfaces.

Sample Image - Inductive_Presentation.jpg

Introduction

While reading the stories at MSDN about inductive user interfaces, I could not find any suitable code for use in my own applications. No small library containing a simple framework for building such a thing in your own application.

With this article I will not only explain again how you can build a framework for inductive user interfaces yourself, but also provide a framework for those people who don’t want to create the framework themselves, but want to go right ahead and create applications using this framework.

What are inductive user interfaces?

Inductive user interfaces are in short, interfaces in which a non-experienced user can find his way quickly. He can start performing tasks using the user interface without having learned anything in advance.

While these kinds of user interfaces work well for non-experienced users, it’s a complete nightmare for experienced users to use these kinds of user interfaces.

You should choose well between an inductive and a deductive user interface before building anything. An inductive user interface can mean both success and complete failure for your software. It depends on what the target audience of your software is, what type of user interface you are going need in your application. Of course, you can include both an inductive and a deductive user interface. The choice is completely yours.

Component design

The framework itself is pretty simple. The MVC pattern is clearly visible; the PagerModel is the model of the pattern (which you can make up from the name of the class). The PagerView is the view for the model and the PagerWindow is the controller, containing the view and the model.

The PagerModel uses a stack to keep track of the history. This is the best way to maintain the page's history, because the last page that came into the history is also the first page we want to display when going one page back in the history. The same thing is true for another stack I used. The second stack is for pages that were popped from the original history stack. These need to be put on this second stack, so we can navigate to a next page in the history.

When the PagerModel navigates to a page, it fires an event indicating its current page has been changed. Both the view and the controller are registered to this event. If the current page in the PagerModel class changes, the view automatically updates itself through the use of the event handler.

The PagerWindow automatically updates the state of the toolbar buttons when the PagerModel changes. This way you have a more loosely coupled model which has big advantages when extending the model, view or controller with more functionality.

Using the framework

I included a sample in the source code which makes use of the framework, which contains two pages. One page links to the other page. This way you can see how the framework works.

To use the framework you will need one or more pages. You can simply derive them from the Page class and put your own controls on it.

Next you will need to setup the model, view and controller. The following piece of code initializes a PagerModel, inserts a page is homepage for the model. Attaches the model to a PagerWindow and displays the window to the user.

C#
PagerWindow window = new PagerWindow();
PagerModel model = new PagerModel();

model.HomePage = new MyHomePage();

window.Pager = model;
window.Show();

Navigating between pages is quite easy to setup. In the Page class there’s a reference to the PagerModel class. We can simply navigate to another page using the following piece of code:

C#
Pager.Navigate(new MyNextPage());

Conclusion

There are a lot more things possible with the framework than just the things I showed here. If you experiment with the framework, you can even build your own help system with it. Or use it for other purposes.

I hope you enjoyed reading this article. If you have any bugs, comments, suggestions or questions. Don’t hesitate to drop me a message.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Netherlands Netherlands
----

Comments and Discussions

 
GeneralMy vote of 1 Pin
ZTransform20-Mar-09 8:30
ZTransform20-Mar-09 8:30 
its not really a "framework" and there is no code
Generalsample code not working due to missing references Pin
Lokendra Panwar18-May-05 2:29
Lokendra Panwar18-May-05 2:29 
GeneralRe: sample code not working due to missing references Pin
WillemM18-May-05 4:15
WillemM18-May-05 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.