TaskDialogs not working in Rhino


#1

Hi,

I’m having trouble adopting our application to be used as a Rhino plugin. We are using RhinoCommon and C# to write a plugin for Rhino5 64bit. We reference the nuget package WindowsAPICodePack-Core 1.1.2 (with a small fix to work in 64bit) to show a TaskDialog with custom buttons - but it’s not working. Anyone had similar experiences? It’s working perfectly if started as NUnit test or as plugin for other CAD software.

Simon


(Dale Fugier) #2

Hi Simon,

The Rhino installation includes the WindowsAPICodePack. Thus, you should just reference the one that comes with Rhino.

C:\Program Files\Rhinoceros 5 (64-bit)\System

Here is a sample (that works).

TestTaskDialog.zip (3.8 KB)

– Dale


#3

If I change your sample it does not work:

remove the radio buttons and add

td.Cancelable = true;

var tdb = new TaskDialogButton("tdbBtn1", "Custom Button 1"); // TaskDialogCommandLink does not work, too
tcb.Click += (s, d) => td.Close(TaskDialogResult.CustomButtonClicked);
td.Controls.Add(tcb);

the only way to close this TaskDialog is using the X.

But thanks, you pointed me in the right direction. The culprit is that Rhino is shipping it’s own ApiCodePack dll. It looks like an old version. It’s definitely missing the fix https://github.com/aybe/Windows-API-Code-Pack-1.1/commit/5de444bd2f51ea935e244b7b8ce405a2cdc809a1 as I can see in the decompiler.

How are the chances for the fix in a Service Release?

Thanks
Simon


(Dale Fugier) #6

Hi @Simon_Weinberger,

There won’t be another service release of Rhino 5, and the Rhino 6 WIP (work-in-progress) does not require this assembly.

I guess you could replace the version of Microsoft.WindowsAPICodePack.dll, that ships with Rhino, with the newer one.

– Dale


#7

You mean replacing in the Rhino installation folder? Wouldn’t want to do that.

I already ship my own version next to my plugin assembly, but the version from the Rhino installation folder is used. Of course I can rename the dll and link to that renamed assembly.

Thanks
Simon


(Dale Fugier) #8

Yep, that’s preferred.

– Dale