Skip to content

Commit fecd93b

Browse files
committed
Remove unnecessary variable from DockableToolwindowPresenter
Also add an explanatory comment for the use of dynamic
1 parent d418f7a commit fecd93b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Rubberduck.Core/UI/DockableToolwindowPresenter.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,15 @@ private IWindow CreateToolWindow(IDockableUserControl control)
6767
Logger.Error(exception);
6868
throw;
6969
}
70-
71-
// could cast to COM_IOleWindow for the first few, but AddUserControl is only on _DockableWindowHost
72-
dynamic userControlHost = _userControlObject;
70+
7371
toolWindow.IsVisible = true; //window resizing doesn't work without this
74-
7572
EnsureMinimumWindowSize(toolWindow);
76-
7773
toolWindow.IsVisible = _settings != null && _settings.IsWindowVisible(this);
7874

79-
userControlHost.AddUserControl(control as UserControl, new IntPtr(_vbe.MainWindow.HWnd));
75+
// currently we always inject _DockableToolWindowHost from Rubberduck.Main.
76+
// that method is not exposed in any of the interfaces we know, though, so we need to invoke it blindly
77+
((dynamic)_userControlObject).AddUserControl(control as UserControl, new IntPtr(_vbe.MainWindow.HWnd));
78+
8079
return toolWindow;
8180
}
8281

0 commit comments

Comments
 (0)