Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design issues
Message
From
05/08/2010 14:01:23
 
 
General information
Forum:
ASP.NET
Category:
Class design
Title:
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01475236
Message ID:
01475381
Views:
41
>I think you need to use a delegate. Oversimplifing your example (and using C# I'm afraid):
   public class ViewPageClass
>    {
>        public void GetPage()
>        {
>            Parser p = new Parser();
>           // Replace default handling.
>            p.handler = SpecificReplaceWithThisContent;
>            bool b = p.ReplaceWithThisContent();
>        }
>
>        public bool SpecificReplaceWithThisContent()
>        {
>            return false;
>        }
>
>    }
>    public class Parser
>    {
>        public delegate bool Doit();
>
>        public Doit handler;
>
>        public bool ReplaceWithThisContent()
>        {
>            if (handler != null)
>            {
>                return handler();
>            }
>            else
>            {
>                //Do the default handling. E.g:
>                return false;
>            }
>        }
>    }}
So a call to Parser.ReplaceWithThisContent() will actually run the ViewPageClass.SpecificReplaceWithContent()

I think this approach is similar to the one from Denis. Also, later on in this thread, in Message #1475334, I provided the current approach I am using which is simply about making a public method in the client and calling it from the class. Do you see any downsize in that approach?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform