IWindowControl IWindowControl.GetTopLevelControl() { //TODO: review here again Form form1 = control.FindForm(); Control realTopLevelWindowControl = control.TopLevelControl; realTopLevelWindowControl = form1; ///MoonTrip version ///for use in extensions custom tool ///Form in ToolWindow is can not top level ///create some fake Form to TopLevelControl if (realTopLevelWindowControl == null) { realTopLevelWindowControl = new Form(); } if (topLevelWindowControl == null || topLevelWindowControl.control != realTopLevelWindowControl) { return(topLevelWindowControl = (realTopLevelWindowControl is Form) ? (MyWindowControl)MyWindowForm.TryGetWindowControlOrRegisterIfNotExists((Form)realTopLevelWindowControl) : MyWindowControl.TryGetWindowControlOrRegisterIfNotExists(realTopLevelWindowControl)); } return(topLevelWindowControl); }
IWindowControl IWindowControl.GetTopLevelControl() { //TODO: review here again Control realTopLevelWindowControl = control.TopLevelControl; if (topLevelWindowControl == null || topLevelWindowControl.control != realTopLevelWindowControl) { return(topLevelWindowControl = (realTopLevelWindowControl is Form) ? (MyWindowControl)MyWindowForm.TryGetWindowControlOrRegisterIfNotExists((Form)realTopLevelWindowControl) : MyWindowControl.TryGetWindowControlOrRegisterIfNotExists(realTopLevelWindowControl)); } return(topLevelWindowControl); }