Click here to Skip to main content
15,891,647 members
Home / Discussions / C#
   

C#

 
GeneralRe: huffman tree algorithm Pin
jtmtv1824-Jul-03 7:52
jtmtv1824-Jul-03 7:52 
GeneralRe: huffman tree algorithm Pin
Julian Bucknall [MSFT]24-Jul-03 8:50
Julian Bucknall [MSFT]24-Jul-03 8:50 
GeneralRe: huffman tree algorithm Pin
Frank Olorin Rizzi24-Jul-03 16:39
Frank Olorin Rizzi24-Jul-03 16:39 
GeneralMultithreaded application design question. Pin
GriffonRL23-Jul-03 11:11
GriffonRL23-Jul-03 11:11 
GeneralRe: Multithreaded application design question. Pin
wightman_michael22-Dec-09 15:40
wightman_michael22-Dec-09 15:40 
QuestionMethodInfo Invoke, bad performance? Pin
STW23-Jul-03 9:15
STW23-Jul-03 9:15 
AnswerRe: MethodInfo Invoke, bad performance? Pin
Eric Gunnerson (msft)23-Jul-03 10:02
Eric Gunnerson (msft)23-Jul-03 10:02 
GeneralRe: MethodInfo Invoke, bad performance? Pin
STW26-Jul-03 23:37
STW26-Jul-03 23:37 
I thought I had an "extremly cunning plan" but hope you can tell me a better solution:

I'm programming a little game with a lot of UserControls. These UserControls are filled with Data. But I don't like to pass DataAccess references to all of these Controls, so I thought I do it like in C++. MFC C++ Prgs are splitted in UI Views and Documents. Each View can have a document. From this document it's very simple to update the views
(GetDocument().UpdateView(Name)) with new data.
In this scenario I wouldn't have to pass references to the DataSet; I just have to programm a document class which handles adding Document Items (Controls, which are "listening" to changes of the document) and the Controls Update Methods. I made it like this:
object array for the document items
String array for the Update Method Name of the Control
DocumentType, so I can Update only specific controls.
MyDocument.AddDocumentItem(this.AreaControl1, "AreaCtrlUpdate", DocumentTypes.AreaControl)
The Document has a DataSet and properties.
So when the documents data changed with the set method of a property this will Update my Document Items. To Invoke a Method of a object I needed MethodInfo.Invoke() Method. Each DocumentItem have to implement a method like CtrlUpdate(Document pDoc). I add as a passing parameter of the CtrlUpdate method the Document itsself.
What I found very good was first that Data is only stored at one place (in the document) and there is even no need to store IDs in the UserControls. Second there's no need to pass DataSet or DataAccess Object References because the DataSet is passed with the Document to the Controls Update Method. In the document I fix which Controls to Update if a property or the dataset changed. That's good because I can fix which Controls to update at only one place, in the document and there's no need that a control has object references to other controls which have to actualisize when the data was changed by the control. I just set the new property in the document and this will cause the Update Method of the other Controls.

I made a mistake and so I meant that MethodInfo.Invoke() is very slow (Seconds to Invoke).


So what do you mean with calling Methods through an interface? Is there a better solution for this scenario? Could you give me an example?

I think about to use databinding with these UserControls but I couldn't find examples how to set a datasource, datamember for a UserControl. Do you know how to set datasource of usercontrols?

Thank you!

Stefan






GeneralRe: MethodInfo Invoke, bad performance? Pin
Eric Gunnerson (msft)27-Jul-03 5:23
Eric Gunnerson (msft)27-Jul-03 5:23 
GeneralRe: MethodInfo Invoke, bad performance? Pin
STW27-Jul-03 8:48
STW27-Jul-03 8:48 
AnswerRe: MethodInfo Invoke, bad performance? Pin
Daniel Turini23-Jul-03 11:31
Daniel Turini23-Jul-03 11:31 
GeneralRe: MethodInfo Invoke, bad performance? Pin
STW26-Jul-03 23:41
STW26-Jul-03 23:41 
GeneralAccessing Functions Pin
ppathan23-Jul-03 6:08
ppathan23-Jul-03 6:08 
GeneralRe: Accessing Functions Pin
Rocky Moore23-Jul-03 12:39
Rocky Moore23-Jul-03 12:39 
QuestionHow to birng to top an application? Pin
Ivan Fernandez23-Jul-03 3:51
Ivan Fernandez23-Jul-03 3:51 
AnswerRe: How to birng to top an application? Pin
Valeria Bogdevich23-Jul-03 9:44
Valeria Bogdevich23-Jul-03 9:44 
GeneralRe: How to birng to top an application? Pin
Ivan Fernandez23-Jul-03 21:41
Ivan Fernandez23-Jul-03 21:41 
GeneralRe: How to birng to top an application? Pin
Valeria Bogdevich23-Jul-03 22:05
Valeria Bogdevich23-Jul-03 22:05 
GeneralReflector Pin
monrobot1323-Jul-03 3:22
monrobot1323-Jul-03 3:22 
GeneralRe: Reflector Pin
Nathan Blomquist23-Jul-03 4:55
Nathan Blomquist23-Jul-03 4:55 
GeneralRe: Reflector Pin
Erick Sgarbi23-Jul-03 17:41
Erick Sgarbi23-Jul-03 17:41 
GeneralRe: Reflector Pin
Ista24-Jul-03 5:54
Ista24-Jul-03 5:54 
GeneralRe: Reflector Pin
Arun Bhalla24-Jul-03 12:00
Arun Bhalla24-Jul-03 12:00 
GeneralRegEx Pin
Iulian Serban23-Jul-03 2:11
Iulian Serban23-Jul-03 2:11 
GeneralRe: RegEx Pin
Rein Hillmann23-Jul-03 5:55
Rein Hillmann23-Jul-03 5:55 

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.