WealthScript Inheritance
Author: Ben_Zurich
Creation Date: 3/21/2012 11:55 AM
profile picture

Ben_Zurich

#1
In an attempt to setup Visual Studio for WL6 I wanted to structure my core programs in separate classes whose methods could be accessed within the Execute() method. A "core program" could be for instance the painting of vertical zigzag (peak/trough of the base) lines througout all panes. I want to have such core programs in separate classes.

In order to do this I first wanted to have those separate classes in the native WL6 C# editor (all in the same file). Naturally, I want to have access to DataSeries as well as to graphics within those core programs. Therefore I had to inherit the WealthScript class. And this is where the problems started. First of all, I am obliged to have a Execute() method even though the core program is no strategy but serves an entirely different purpose. Second, after having coded a dummy Execute() method within my core class that inherits WealthScript, I was not able to pass parameters to the core method. I get the error that the parameters are nor instances of an object.

I hope you understand my goal. How can I do this?
profile picture

Eugene

#2
Check this out - to pass WealthScript object by reference:

Example 1:
CODE:
Please log in to see this code.


Example 2 by Aleksey:
CODE:
Please log in to see this code.


Also, Community Components source code, lost of illustrations of the technique above

Hope this helps.
profile picture

Ben_Zurich

#3
Yep. Thanks a lot!
profile picture

psimmons

#4
I am trying to start using Visual Studio's unit testing capabilities for my libraries.

I try to inherit Wealthscript by passing the object. I do this in MyTestMethod because VS does not find Assert if I try to put it in Execute { }

I test to see if the object is inherited successfully by checking to see if the object is null and the result suggests that it is ok.

So then I try to do something basic like SetContext, but this fails with a Null Reference Exception.

CODE:
Please log in to see this code.


Perhaps I am going about this incorrectly? Do you use a unit test package? Thanks
profile picture

Eugene

#5
Does WealthScript inheritance work? Yes of course. ws.SetContext is part of many a production code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).