M
michelQA
I'm having a funny problems and questions with classes. It's little
hard to explain so I'm focusing on the expected result needed to find
possible solution.
In a C# dll I want to create a kind of "Scripting language" to
manipulate UI elements class of the System.Windows.Forms.* classes.
The final goal is to being able to use Classes and or functions to
fits to the following needs.
Afer referencing the dll in a c# form project I want to interact with
the .dll like this :
Example 1 : Showing button7 button text
MessageBox.Show(Button("button7").Text);
//Note "Button" function must come from the .dll without any
initialisation
Example 2 : Click button1 button
Button("button1").Click(); //Not the event, a special click function
with particular param
Example 3 : Showing if ListView item "Item2" is selected
MessageBox.Show(ListView("listView1").Items("item2").Selected.ToString
());
=======================
Question 1 :
In ex1 button can be simply a function like this... (we dont care
about how I fill class/object/properties)
public static Button xButton(string RecString)
{
Button Btn = new Button();
//...
//We already get the properties and fill Btn properties by
communicating with our tcp test client here somehow...blablabla
//...
return (Button)Btn;
}
This works directly in the c# project but may be sounds like a stupid
question but how can I put this function in a C# dll without having to
previously create the instance with the class name... I want to avoid
MyDllClass.XButton in the C# project.
Question 2 : Having a Button() instead of a XButton() function is
totally impossible if I want to keep reference to System.Windows.Forms
in my dll ?
Question 3 : Is there a way to inherits from the ...Forms.ListView
class and change the way the Items[] indexers is working to
support .Items[TextItem].Selected (string index) instead of .Items
[0].Selected?? (int index) ...create an extra function Items() to
return the correct ListViewItem?
is Adding extra functions to existing Forms.* classes with inheritance
make sense?
For now, my only option is to remove System.Windows.Forms references
in my DLL and use "Custom made" classes almost identical to
System.Windows.Froms classes. Since the goal of my "scripting
language" is mostly to interact with existing object and get object
properties it can live with major limitations (Ex: the end users do
not create any UI element, the script have no UI too and will be used
by a tool to automate Software testing)
I really need to be pointed to interresting things a get some advises
to figure out the best way to do this. I only care about the way to
define this in a .dll and get some ideas to "fits" to an homebrew kind
of scripting language without previous initialisations hosted in a
full C# script done with CS-Script.
hard to explain so I'm focusing on the expected result needed to find
possible solution.
In a C# dll I want to create a kind of "Scripting language" to
manipulate UI elements class of the System.Windows.Forms.* classes.
The final goal is to being able to use Classes and or functions to
fits to the following needs.
Afer referencing the dll in a c# form project I want to interact with
the .dll like this :
Example 1 : Showing button7 button text
MessageBox.Show(Button("button7").Text);
//Note "Button" function must come from the .dll without any
initialisation
Example 2 : Click button1 button
Button("button1").Click(); //Not the event, a special click function
with particular param
Example 3 : Showing if ListView item "Item2" is selected
MessageBox.Show(ListView("listView1").Items("item2").Selected.ToString
());
=======================
Question 1 :
In ex1 button can be simply a function like this... (we dont care
about how I fill class/object/properties)
public static Button xButton(string RecString)
{
Button Btn = new Button();
//...
//We already get the properties and fill Btn properties by
communicating with our tcp test client here somehow...blablabla
//...
return (Button)Btn;
}
This works directly in the c# project but may be sounds like a stupid
question but how can I put this function in a C# dll without having to
previously create the instance with the class name... I want to avoid
MyDllClass.XButton in the C# project.
Question 2 : Having a Button() instead of a XButton() function is
totally impossible if I want to keep reference to System.Windows.Forms
in my dll ?
Question 3 : Is there a way to inherits from the ...Forms.ListView
class and change the way the Items[] indexers is working to
support .Items[TextItem].Selected (string index) instead of .Items
[0].Selected?? (int index) ...create an extra function Items() to
return the correct ListViewItem?
is Adding extra functions to existing Forms.* classes with inheritance
make sense?
For now, my only option is to remove System.Windows.Forms references
in my DLL and use "Custom made" classes almost identical to
System.Windows.Froms classes. Since the goal of my "scripting
language" is mostly to interact with existing object and get object
properties it can live with major limitations (Ex: the end users do
not create any UI element, the script have no UI too and will be used
by a tool to automate Software testing)
I really need to be pointed to interresting things a get some advises
to figure out the best way to do this. I only care about the way to
define this in a .dll and get some ideas to "fits" to an homebrew kind
of scripting language without previous initialisations hosted in a
full C# script done with CS-Script.