daniel.greil
Member
Hello everyone
I've been trying to develop an Add-on for Alibre Design using C#. My goal ist to develop an add-on which can start a wpf.net window which can access certain Alibre session attributes(filename, filepath, ...).
Since I'm not very experienced using the Alibre API, I've read the Add-on Introduction in the API documentation. But as it turns out, the documentation is not yet completed for C#.
The documentation states that all add-ons share the same basic infrastructure. Then it proceeds describing the "Three important functions", which are only described in c++.
I've used the following forum post for reference, which has been of great help. I've basically copied his AlibreAddOn class into my project.
Now to my question.
I have the following code:
In this example we can see the three important functions: AddOnLoad, AddOnInvoke and AddOnUnload.
If I compile this and run it in Alibre, it only works once. After closing, it is not possible to open it again.
I cannot get this code to work consistently.
I would be grateful for a few tips or maybe even a skeleton on how this file should be.
I've been trying to develop an Add-on for Alibre Design using C#. My goal ist to develop an add-on which can start a wpf.net window which can access certain Alibre session attributes(filename, filepath, ...).
Since I'm not very experienced using the Alibre API, I've read the Add-on Introduction in the API documentation. But as it turns out, the documentation is not yet completed for C#.
The documentation states that all add-ons share the same basic infrastructure. Then it proceeds describing the "Three important functions", which are only described in c++.
I've used the following forum post for reference, which has been of great help. I've basically copied his AlibreAddOn class into my project.
Now to my question.
I have the following code:
C#:
using System;
using AlibreX;
using ZDB_connector.View;
namespace AlibreAddOnAssembly
{
public static class AlibreAddOn
{
private static MainWindow _mainWindow;
public static void AddOnLoad(IntPtr hwnd, IAutomationHook pAutomationHook, IntPtr unused)
{
_mainWindow = new MainWindow();
_mainWindow.Show();
}
public static void AddOnInvoke(
IntPtr hwnd,
IAutomationHook pAutomationHook,
string sessionName,
bool isLicensed,
int reserved1,
int reserved2)
{
}
public static void AddOnUnload(
IntPtr hwnd,
bool forceUnload,
ref bool cancel,
int reserved1,
int reserved2)
{
}
}
}
In this example we can see the three important functions: AddOnLoad, AddOnInvoke and AddOnUnload.
If I compile this and run it in Alibre, it only works once. After closing, it is not possible to open it again.
I cannot get this code to work consistently.
I would be grateful for a few tips or maybe even a skeleton on how this file should be.