chuongmep / chuongmep/RevitAddInManager

AIM not works with Dockable Pane

Open
#57 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C#
Stars
494
Forks
82
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
I'm using a Dockable pane but I can't access my dockablePane from AIM...

On startup I register a new Dockable with Guid
like this :
```
//register in application with a new guid
UIApplication uiapp = new UIApplication(sender as Application);
_uiApplication = uiapp;

// *** Code pour enregistrer ta nouvelle PanoDockablePane ***
PanoDockablePane panoPane = new PanoDockablePane();
_panoPane = panoPane; // Sauvegarder l'instance

DockablePaneId panoDockablePaneId = new DockablePaneId(new Guid("{3C19FAAC-140C-4B24-A1B3-782EB5E242C4}"));
uiapp.RegisterDockablePane(panoDockablePaneId, "PanoDockablePane", _panoPane as IDockablePaneProvider);
```

As you can see, I also do
`PanoDockablePane panoPane = new PanoDockablePane();
_panoPane = panoPane; // Sauvegarder l'instance`

in order to call public method I made in my public partial class PanoDockablePane : System.Windows.Controls.UserControl, IDockablePaneProvider like SetupCamera or LoadPanoramaTexture

Then, in my public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
I've got this :

` // GUID de la DockablePane
DockablePaneId dockablePaneId = new DockablePaneId(new Guid("{3C19FAAC-140C-4B24-A1B3-782EB5E242C4}"));

// Récupérer la DockablePane
DockablePane dockablePane = _uiapp.GetDockablePane(dockablePaneId);

// Afficher la DockablePane si elle est trouvée
if (dockablePane != null)
{
dockablePane.Show();
}
else
{
MessageBox.Show("Erreur : Impossible de trouver la DockablePane avec cet ID", "Erreur critique", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

#if DEBUG
//Do nothing

#else
PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane();

#endif

panoPane.Fov = fov;
panoPane.SetupCamera();
panoPane.LoadPanoramaTexture(str_url, scanNamme);`

In Release Mode (using by AddInManager), if I do
PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane();
I can do panoPane.SetupCamera(); and it works

BUT, in debug mode I've got an error in this line :
PanoDockablePane panoPane = SettingUpRibbon.GetPanoDockablePane();
Wich is normal because AIM can't access to SettingUpRibbon!

But, in Debug mode, nothing happens with those lines:

`panoPane.Fov = fov;
panoPane.SetupCamera();
panoPane.LoadPanoramaTexture(str_url, scanNamme);`

Do you know why?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.