Customize the user code defaults

Ranorex Spy, Recorder, and Studio.
phxceptance
Posts: 3
Joined: Thu Sep 26, 2013 12:03 pm

Customize the user code defaults

Post by phxceptance » Thu Sep 26, 2013 12:34 pm

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!

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

Re: Customize the user code defaults

Post by Support Team » Fri Sep 27, 2013 2:34 pm

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)
.
Image

phxceptance
Posts: 3
Joined: Thu Sep 26, 2013 12:03 pm

Re: Customize the user code defaults

Post by phxceptance » Fri Sep 27, 2013 4:04 pm

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?

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

Re: Customize the user code defaults

Post by Support Team » Mon Sep 30, 2013 1:00 pm

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)
.
Image

phxceptance
Posts: 3
Joined: Thu Sep 26, 2013 12:03 pm

Re: Customize the user code defaults

Post by phxceptance » Mon Sep 30, 2013 1:46 pm

Hi,

thank you for the clarification.

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

cxkf
Posts: 12
Joined: Thu Apr 04, 2013 12:53 pm

Re: Customize the user code defaults

Post by cxkf » Mon Sep 30, 2013 2:59 pm

Support Team wrote: A possible future implementation of such a template will be discussed.
Great. I'd like to have such a template too :-)