TeeChart.Net v3 in a Windows Service

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

TeeChart.Net v3 in a Windows Service

Post by Centrii » Thu Jul 23, 2009 2:29 pm

Hello Steema Team,

I want to use the Teechart.Net v3 in a Windows Service to export Charts in jpeg-files.
I tried to create a new Chart with "new Chart()" in the Service, but it doesn´t work. My Service stoped immediately
without any Exception.
Is it possible to do something like this, and if yes, can I find somewhere an Example or a tutorial?

Greets Centrii

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Mon Jul 27, 2009 5:42 am

Hello Steema Team,

I´m still working on this Issue and I found a Post in this forum that it should work.
But it doesnt´t work for me.
I hope that you can give some advise to solve my problem.

Greets Centrii

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart.Net v3 in a Windows Service

Post by Narcís » Mon Jul 27, 2009 8:00 am

Hi Centrii,

Have you tried creating a Steema.TeeChart.TChart instead of a Steema.TeeChart.Chart?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Mon Jul 27, 2009 8:28 am

Hello Narcís,

thank you for your answer.
I tried now creating with Steema.TeeChart.TChart, but still have the same Problem.
My Service stop immediately without any Exception after I call

Code: Select all

 Steema.TeeChart.TChart report = new Steema.TeeChart.TChart();
Greets Centrii

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart.Net v3 in a Windows Service

Post by Narcís » Mon Jul 27, 2009 11:49 am

Hi Centrii,

Could you please try assigning the Administrator account to the service to see if it makes a difference.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Tue Jul 28, 2009 5:34 am

Hi Narcís,

I already tried the Administrator Account, but this has no effect.

Greets Centrii

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Tue Jul 28, 2009 6:39 am

Hi Narcís,

I tried it also in a Windows Forms application and it works great with the same Function like in my Windows Service.

Code: Select all

            try
            {
                String Filename = @"C:\test_" + DateTime.Now.ToString("dd_hhmmss") + ".jpg";

                Steema.TeeChart.TChart report = new TChart();

                report.Chart.Height = 768;
                report.Chart.Width = 1024;
                Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(report.Chart);

                line.Active = true;
                line.FillSampleValues(50);
                line.Title = "Test";

                report.Legend.Visible = true;

                report.Export.Image.JPEG.Save(Filename);
            }
            catch (Exception ex)
            {

            }
I´m using the same TeeChart.dll

I hope you can give me some usefull advise.

Greets Centrii

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart.Net v3 in a Windows Service

Post by Narcís » Tue Jul 28, 2009 10:15 am

Hello Centrii,

Thanks for the information.

In that case it may be a licensing issue. Can you please download the evaluation version and install it in another machine so that we can check if it's a licensing problem? Evaluation version has no license control but expires after 40 days of its installation. If evaluation version works and registered version doesn't we will try to provide a solution to the problem.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Tue Jul 28, 2009 12:54 pm

Hello Narcís,

I dont have a second machine where I can install VS and the Eval version.
But I uninstalled the TeeChart v3 completely from my machine and installed the new v2009 evaluation version (4.0.2009.21357)
and I still get the same error.
Meanwhile I figured out that I probably get a System.IO.FileNotFoundException as soon I want to create a new TChart.
Rigth now I have no idea what I have to do next to solve the Problem.
I hope you can give me some more advice.

Thank you in advance

Greets Centrii

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart.Net v3 in a Windows Service

Post by Narcís » Tue Jul 28, 2009 2:19 pm

Hi Centrii,

In that case it could be that your Windows Service can't find TeeChart.dll. You could check it using File.Exists, for example:

Code: Select all

			if (System.IO.File.Exists("TeeChart.dll"))
			{
				Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart(); 
			}
You could also try loading TeeChart.dll dynamically, for example:

Code: Select all

		private CompilerParameters compilerParams;

		private void InitializeCompilerParameters()
		{
			//add compiler parameters
			compilerParams = new CompilerParameters();
			compilerParams.CompilerOptions = "/target:library /optimize";
			compilerParams.GenerateExecutable = false;
			compilerParams.GenerateInMemory = true;
			compilerParams.IncludeDebugInformation = false;
			compilerParams.ReferencedAssemblies.Add("mscorlib.dll");
			compilerParams.ReferencedAssemblies.Add("System.dll");
			compilerParams.ReferencedAssemblies.Add("System.Drawing.dll");
			compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
			compilerParams.ReferencedAssemblies.Add(Application.StartupPath + "\\TeeChart.dll");
		}
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Centrii
Newbie
Newbie
Posts: 23
Joined: Mon Jun 23, 2008 12:00 am

Re: TeeChart.Net v3 in a Windows Service

Post by Centrii » Tue Jul 28, 2009 2:53 pm

Hello Narcís,

Thank you very much. :D
Loading TeeChart.dll dynamically did help.
I cannot explain why my Service don´t find the dll, because it is in the same folder like the Service.
I will try to figure it out, but for now I´m happy with this solution.

Thanks again

Greets Centrii

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart.Net v3 in a Windows Service

Post by Narcís » Tue Jul 28, 2009 3:11 pm

Hi Centrii,

You're very welcome! I'm glad to hear that helped.
I cannot explain why my Service don´t find the dll, because it is in the same folder like the Service.
I will try to figure it out, but for now I´m happy with this solution.
You could check TeeChart's AssemblyFolders settings as described here or you may need to register TeeChart.dll in the GAC if it isn't. Here you'll find and example on how to register TeeChart.dll to the GAC.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply