public override void Execute(string argument) { ISmartToolWindow wnd = _smartSession.SmartWindowManager.SmartToolWindowFactory.GetSmartToolWindow(_id); if (wnd != null) { wnd.Init(_smartSession); Form mainFrm = _smartSession.SmartWindowManager.MainForm as Form; int wndWidth = 260; int wndHeight = 200; int x = mainFrm.Right - wndWidth - 7; int y = mainFrm.Bottom - wndHeight - 8; Rectangle rect = new Rectangle(x, y, wndWidth, wndHeight); _smartSession.SmartWindowManager.DisplayWindow(wnd, new WindowPosition(System.Windows.Forms.DockStyle.None, false), rect); } }
public ISmartToolWindow GetSmartToolWindow(int identify) { if (_openedToolWindows.ContainsKey(identify)) { return(_openedToolWindows[identify]); } if (_registeredToolWindows.ContainsKey(identify)) { ISmartToolWindow wnd = Activator.CreateInstance(_registeredToolWindows[identify]) as ISmartToolWindow; if (wnd == null) { return(null); } wnd.Init(_session); _openedToolWindows.Add(identify, wnd); (wnd as ToolWindow).Disposed += new EventHandler((sender, args) => { _openedToolWindows[identify].Free(); _openedToolWindows.Remove(identify); }); return(wnd); } return(null); }