License problem when TeeChart not referenced in main appli

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
annelise
Newbie
Newbie
Posts: 28
Joined: Wed Jul 18, 2007 12:00 am
Contact:

License problem when TeeChart not referenced in main appli

Post by annelise » Thu Dec 20, 2007 2:51 pm

Hi,

A few month ago we mentioned you a problem we add using TeeChart (version 3.2.2746.19160) in applications that does not reference it directly, but via intermediate dlls.
You answer us we can solve it using the patch TeeChartNET3PlugInLic.exe.

I tried it:

1- I installed the patch on my development machine.

2- I wrote a very simple dll (ClasseUsingATeeChartInDesignMode.dll)

which reference the TeeChart.dll, defines the following classn wher Form1 is a windows form on which I put a TeeChart in design mode.

public class ClassUsingTeeChart
{
private Form1 mForm;

public ClassUsingTeeChart()
{
mForm = new Form1();
}
public void ShowFormWithTeeChart()
{
mForm.Show();
}
}

3-I wrote a very simple application (MyApplication.exe) that references ClasseUsingATeeChartInDesignMode.dll (but no TeeChart.dll)
with the following program:

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form2());
}
}

Where Form2 is a simple Winfows form with a button to display Form1 and its TeeChart.

public partial class Form2 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
ClassUsingTeeChart classUsingTeeChart = new ClassUsingTeeChart();
classUsingTeeChart.ShowFormWithTeeChart();

}
}

When I try to execute my application on my development machine, I have no problem, but when I try it on a machine which has no teeChart installed, but only the TeeChart.dll in the same directory as the application one, I still have the following error:

“An instance of type SteemaTeeChart.Chart was being created and a valid licence could not be granted for the type Steema.TeeChart.Chart…”.

So do I forgot to do something ? or perhaps I don’have the good patch ?
Il would be pleased if you could help me…

Anne-Lise

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Thu Dec 20, 2007 11:34 pm

Hello Anne-Lise,

It is not clear from your post whether you are passing your dll assembly, ClasseUsingATeeChartInDesignMode, to TeeChart in it's constructor (see the example plugin project for an example). Please check if that is the case. It is important that at least the first Chart created by your dll receives as argument, the assembly that it needs to associate its license to. You can modify the automatically created empty constructor accordingly:
Eg.

Code: Select all

Steema.TeeChart.TChart myChart = new Steema.TeeChart.TChart(this);
Regards,
Marc Meumann
Steema Support

annelise
Newbie
Newbie
Posts: 28
Joined: Wed Jul 18, 2007 12:00 am
Contact:

License problem with TeeChart

Post by annelise » Fri Dec 21, 2007 3:06 pm

Hi and thank you for your answer,

Indeed, I did not pass any parameter in the TChart constructor, and doing this it works in my prototype (when I pass Form1: the class of my dll which instanciate the chart).
But I have still a problem with my real application which is not as simple as the prototypes.

In this application, I don't instanciate a TChart directly, but an object of a class derivating from TChart like following:

DerivatedClass : TChart
{
// so I added a parameter in my constructor
public void DerivatedClass(param1, pram2...,object instance):base(instance)

}

But I dont clearly understand what to pass in this parameter when I instanciate my DerivatedClass,
Is it: This <=> the object that instanciate the DerivatedClass (It does'n work)
or is it the dll in which I instanciate it:
System.Reflection.Assembly.GetExecutingAssembly(), (it does'nt work anymore).
Is it the parent form of the DerivatedClass object ?...

Please could you tell me exactly what parameter to pass in this constructor ?

Thanks a lot,

Anne-Lise

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Mon Dec 24, 2007 9:20 am

Hello Anne-Lise,

Please check that you have the licenses.licx file at the project level in which the TeeChart is being bound (ie. the assembly that uses DerivatedClass). That is the assembly that should be passed in the constructor. We'll need to run up a test here to confirm behaviour if that doesn't work but that is the setup that I believe should work ok.

Are there any license errors at compile time?

Regards,
Marc
Steema Support

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Thu Dec 27, 2007 11:18 am

Hello Anne-Lise,

Following up with a check on the previous post. The principle works as expected when tested with the plugin version of TeeChart.

If we imagine that your class derives from TChart:

Code: Select all

public class DerivedChart : TChart
Then you need to overload the constructor as follows:

Code: Select all

public DerivedChart(object instance) : base(instance) { }
and pass your calling assembly on creation:

Code: Select all

DerivedChart.DerivedChart derivedChart = new DerivedChart.DerivedChart(this);
The project that is creating the chart (calling the above line) should contain the licenses.licx file.

Regards,
Marc
Steema Support

Post Reply