I have an issue with an Inventor 2017 AddIn,when user closes the UserControll on Dockable Window.
I don't know how to make it open again "properly".
I should probably implement the Remove() or Dispose() UserControll event on Dockable Window closing...
Please advice me how to do it right.
StandardAddInServer.cs:
invApp = addInSiteObject.Application;
public int DWnum = 0;
void landing_buttonDef_OnExecute(NameValueMap Context)
{
UserControl DW;
DW = new DockableWindow.landings(invApp, DWnum++);
}
landings.cs:
public partial class landings : UserControl
{
const string kInternalNameFmt = "TestWindow";
const string kTitleFmt = "Test Window";
int kWindowNumber;
public landings(Inventor.Application invApp, int DWnum)
{
InitializeComponent();
kWindowNumber = DWnum;
ShowDockableWindow(invApp);
}
void ShowDockableWindow(Inventor.Application invApp, )
{
string windowInternalName = String.Format(kInternalNameFmt);
string windowTitle = String.Format(kTitleFmt);
UserInterfaceManager uiMgr = invApp.UserInterfaceManager;
try
{
myDockableWindow = uiMgr.DockableWindows.Add(StandardAddInServer.ClientIdString, windowInternalName+kWindowNumber.ToString(), windowTitle);
myDockableWindow.AddChild(this.Handle);
this.Visible = true;
myDockableWindow.Visible = true;
} catch (Exception e){}
}
}
2 variants to myDockableWindow = uiMgr.DockableWindows.Add(...) above, which I would like to "repair":
.
Solved! Go to Solution.
I have an issue with an Inventor 2017 AddIn,when user closes the UserControll on Dockable Window.
I don't know how to make it open again "properly".
I should probably implement the Remove() or Dispose() UserControll event on Dockable Window closing...
Please advice me how to do it right.
StandardAddInServer.cs:
invApp = addInSiteObject.Application;
public int DWnum = 0;
void landing_buttonDef_OnExecute(NameValueMap Context)
{
UserControl DW;
DW = new DockableWindow.landings(invApp, DWnum++);
}
landings.cs:
public partial class landings : UserControl
{
const string kInternalNameFmt = "TestWindow";
const string kTitleFmt = "Test Window";
int kWindowNumber;
public landings(Inventor.Application invApp, int DWnum)
{
InitializeComponent();
kWindowNumber = DWnum;
ShowDockableWindow(invApp);
}
void ShowDockableWindow(Inventor.Application invApp, )
{
string windowInternalName = String.Format(kInternalNameFmt);
string windowTitle = String.Format(kTitleFmt);
UserInterfaceManager uiMgr = invApp.UserInterfaceManager;
try
{
myDockableWindow = uiMgr.DockableWindows.Add(StandardAddInServer.ClientIdString, windowInternalName+kWindowNumber.ToString(), windowTitle);
myDockableWindow.AddChild(this.Handle);
this.Visible = true;
myDockableWindow.Visible = true;
} catch (Exception e){}
}
}
2 variants to myDockableWindow = uiMgr.DockableWindows.Add(...) above, which I would like to "repair":
.
Solved! Go to Solution.
Solved by yan.gauthier. Go to Solution.
Hi,
I fixed that issue by deleting the dockableWindow in the constructor before creating it another time
UserInterfaceManager userInterfaceManager = inventorApplication.UserInterfaceManager;
foreach (DockableWindow dockableWindow in userInterfaceManager.DockableWindows)
{
if (dockableWindow.InternalName == "TestWindow")
{
dockableWindow.Visible = false;
userInterfaceManager.DockableWindows["TestWindow"].Delete();
}
}
Hi,
I fixed that issue by deleting the dockableWindow in the constructor before creating it another time
UserInterfaceManager userInterfaceManager = inventorApplication.UserInterfaceManager;
foreach (DockableWindow dockableWindow in userInterfaceManager.DockableWindows)
{
if (dockableWindow.InternalName == "TestWindow")
{
dockableWindow.Visible = false;
userInterfaceManager.DockableWindows["TestWindow"].Delete();
}
}
Can't find what you're looking for? Ask the community or share your knowledge.