Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design issues
Message
De
05/08/2010 14:01:23
 
 
À
05/08/2010 13:51:50
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01475236
Message ID:
01475381
Vues:
42
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform