Page 1 of 1

Customize the user code defaults

Posted: Thu Sep 26, 2013 12:34 pm
by phxceptance
Hi,

we would like to have a method call inside the init() method of every .UserCode.cs file of our projects.
We also want this method call to be contained by default in every newly created Recording Module.

Is there any possibility to achieve the latter by modifing e.g. a template or something?

Thanks in advance!

Re: Customize the user code defaults

Posted: Fri Sep 27, 2013 2:34 pm
by Support Team
Hello,

It is possible to create a template for a User Code module that inherits a custom base class.
You would need to adjust the template that is stored in the following location:

Code: Select all

C:\Program Files (x86)\Ranorex 4.1\RanorexStudio\AddIns\AddIns\Misc\RxSharpdevelop\Templates\Files\CSharp
Would it be an option for you to create a Framework DLL that contains your method and reference it in your projects? Please take a look at the folliwng post:
http://www.ranorex.com/forum/can-i-chan ... t4494.html

Regards,
Markus (T)

Re: Customize the user code defaults

Posted: Fri Sep 27, 2013 4:04 pm
by phxceptance
Hey,

thanks for your response.

our goal is to have the code line with the method call contained by default whenever a Recording Module is created.

This is the standard content of the init() method:

Code: Select all

 private void Init()
        {
            // Your recording specific initialization code goes here.
        }
In our projects it should look like this by default (without doing anything in addition):

Code: Select all

 private void Init()
        {
            // Default initialization method call
            Testsuite_XYZ.Code_Modules.UtitlityModule.Instance.Method();
        }
The DLL solution would make the method available, but we would have to add the code line with the method call manually every time a new Recording Module was created, or is there something I misunderstood?

Re: Customize the user code defaults

Posted: Mon Sep 30, 2013 1:00 pm
by Support Team
Hello,

Unfortunately, we currently provide a template for User Code modules only but not for <Recording>.UserCode.cs files. A possible future implementation of such a template will be discussed.

Thank you for your feature request.

Regards,
Markus (T)

Re: Customize the user code defaults

Posted: Mon Sep 30, 2013 1:46 pm
by phxceptance
Hi,

thank you for the clarification.

This feature would be very helpful for us,
we will keep an eye on it :wink:

Re: Customize the user code defaults

Posted: Mon Sep 30, 2013 2:59 pm
by cxkf
Support Team wrote: A possible future implementation of such a template will be discussed.
Great. I'd like to have such a template too :-)