|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
title: generic win-form and web-form components (basolution) author: babak ansari jaberi email: babakansari@yahoo.com member id: 36 language: c# 2.0 platform: windows, .net 2.0 etc technology: asp.net, win froms/components, web forms/components level: intermediate, advanced description: a sample framework to create and use win-form and web-from generic components with the same controller to manipulate components behaviour on screen license: "%22%22%22%22../../info/licenses.aspx%22%22%22%22">cpol
objectivethe objective of this solution is to introduce a framework to create applications having both windows and web user interfaces with almost the same look and feels. introductionall the companies in the world (including software companies) looking for the shortest possible path to produce more quality products (software) in less time with the least possible resources (usually human experts). code reuse has always been a challenge in software industry and one of the key factors to get to the desire quality software with less time and minimum resources. if a company can produce a windows-base and web-base application in one product stream-line then there would be a considerable return of benefits to the company. because producing these two types of applications usually require two or three development methods and each one have their own risks and considerations. the majority of software programs need to have user interface for human interactions. there are various kinds of user interfaces for various purposes. such as: windows-forms for quick and flexible access, web-forms for internet access and so on. this article introduces a software architect that can be used as a pfw (persistent framework) to develop windows and web-base applications using the same business layer and uip (user interface process) controller. the goal in basolution is to have ui components that are common to various kinds of user interfaces so that developers can create and use those components, without being worry about their behavior in different user interface kinds. that means; having generic ui components. the generic components are being access by the developers through a single interface. for example: a generic textbox has a common text property in itextbox interface that is common to both web and windows generic components. obviously, there are some limitations to this approach, but depending on application business needs, those limitations can also be mitigated. even if you are using xaml, the components in xaml are having some properties and events that are common in their meaning to the various kinds of user interfaces.analysiswhat does basolution do? in this framework; application developers do not need to be worry about the kind of user interface they are developing application for, whether it is windows form or web form. only component developers and architects (core developers) need to know about the details of generic components and they might need to make changes if they want to add more functionality or adjust the ui behaviors according to business developers need. so the product stream can be divided into two separate lines:
designhow does basolution work? basolution is a framework in which all the user interface functionalities are identified using interfaces. developing applications in basolution requires .net development and interface programming skills although conceptually it isn’t limited to any technology.developing application is separated into two solutions:
(figure 3.2.1)
refer to the sample code: we have a form (geoform that implements igeoform interface as in the example) with a bunch of components in it (geotblgrid implements igrid, geotbltreeview implements itreeview and entitycombo implements icombobox all inside igeoform). each form has a controller object that implements an interface (igeoform) to hold and use generic components that are being used in both windows and web. in the controller; application developers implement ui behaviors and use business logic layer and other services from the framework common to all user interfaces. the layering architect is as follow:
from the example: geoctrl controller object has a reference to the form that implements igeoform interface to work with its generic components. developas stated in the analysis, there can be two groups of developers (application developers & core developers). like all other technologies, application development is build on top of basolution core and obviously the core is on top of .net framework and so on. each developer group can have a proper framework solution set up to use (refer to the sample program provided):
how to use the basolution framework? in both windows and web solutions; we create a user interface folder (ui folder) such as geofrm form in basefrm folder and in the both we should identify the bacomponents we want to include in these pages using an interface called igeoform. both ui holders should implement following interface that has a bunch of bacomponent interfaces. public interface igeoform
{
string caption{ get; set; }
itextbox geotblname{ get; }
igrid geotblgrid{ get; }
igrid entitytablegrid{ get; }
icombobox geotblkind{ get; }
iaddeditdelete addeditdel{ get; }
ibindingmanager bindingmanager{ get; }
ibindingmanager detailbindingmanager{ get; }
ibindingrelation bindingrelation{ get; }
itreeview geotbltreeview{ get; }
icombobox entitycombo{ get; }
itextbox entitytextbox{ get; }
iaddeditdelete addeditdeldetail{ get; }
}
for windows forms we have: public partial class lookupform : form, igeoform { … public lookupform() { geoctrl ctrl = new geoctrl(this, relationkind.lookup); } … } and for web-forms we have: public partial class lookupform : webpagebase, igeoform { … protected void page_load(object sender, system.eventargs e) { geoctrl ctrl = new geoctrl(this, relationkind.lookup); } … } for both of them we create an instance of a controller implementing igeoform as stated in the above code (new geoctrl(this, relationkind.lookup)). the controller is responsible for using the interfaces provided by generic components. /// geoctrl is the controller class for igeoform public class geoctrl { … public igeoform theform; public geoctrl(igeoform theform, relationkind kind) { /// set the form that uses this controller to a /// variable being used internaly by the controller this.theform = theform; … } … } |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You must Sign In to use this message board. | |||||||||||||||
|
|||||||||||||||
|
|||||||||||||||
|
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 5 Oct 2008 Editor: |
Copyright 2008 by BabakAnsari Everything else Copyright © CodeProject, 1999-2009 Web18 | Advertise on the Code Project |