Data binding in C#

Ask general questions here.
User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Data binding in C#

Post by giuseppe.lacagnina » Tue Nov 24, 2015 11:21 am

Dear all,

I have just found out that from the C# code I can start recording modules with

MyRecording.Start();

Let us assume that the module containing the C# code doing the call is MainModule and that MyRecording has some variables of its own.

The question is, can I

- data binding between global parameters and MainModule
- the C# code of MainModule binds some of the global parameters to the variables of MyRecording
- the C# code calls MyRecording

In other words, I need to know if I can do the data binding of a module inside C# before calling the module itself. I hope I am making myself clear :D

Thanks in advance!!!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Data binding in C#

Post by Support Team » Thu Nov 26, 2015 12:49 pm

Hi giuseppe.lacagnina,

you can bind a global parameter to a recording variable by using the following lines of code
var rec1=Recording1.Instance;
rec1.RecordingVar= TestSuite.Current.Parameters["GlobalParam"]; //Whereby GlobalParam = Name_of_global_Parameter and RecordingVar = Name_Of_Module_Variable
Recording1.Start();
Please find also attached a short Sample Project whereby this code is used to bind the global parameter to a recording variable.

Hope this helps overcoming your intention.
Regards,
Markus (S)
Attachments
CodeBindingSample.zip
(12.73 KiB) Downloaded 41 times
.
Image

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: Data binding in C#

Post by giuseppe.lacagnina » Thu Nov 26, 2015 1:49 pm

Hi!

It looks right, thanks. I will try.

Cheers,

G.