PDA

View Full Version : How to implement a Windows form in the zenon ProjectAddIn?



zenmyway
3rd August 2010, 09:41
Good morning,
how can I get an instance of Zenon project in a windows form that I want to show during runtime?

I understand how to do it in the workspaceaddin but in the projectaddin?

It's correct to replace:
IApplication with IProject
this.Application with this.Project?

Thanks

bernhardf
3rd August 2010, 10:02
Hi,

yes this should work like this:

A short example from my side:

In ThisProject.cs I've got the following code:


public void MyFormSample()
{
Form1 myForm;
try
{
myForm= new Form1(this.Project);
myForm.Show();
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message.ToString() + " " + ex.Source.ToString());
}

In the Form1.cs I have:


...
public partial class Form1 : Form
{
zenOn.IProject myProject;
...

}
...



and


...
public Form1(zenOn.IProject _myProject)
{
InitializeComponent();
myProject = _myProject;
}
...