public void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if ((_edgeBarControl != null) && (!_edgeBarControl.IsDisposed)) { try { _edgeBarControl.Dispose(); } catch { } } } try { ReleaseHandle(); } catch { } _edgeBarControl = null; _disposed = true; } }
public EdgeBarPage(IntPtr hWnd, SolidEdgeFramework.SolidEdgeDocument document, EdgeBarControl edgeBarControl) { _document = document; _edgeBarControl = edgeBarControl; _edgeBarControl.EdgeBarPage = this; // Assign the hWnd to this class. AssignHandle(hWnd); // Reparent child control to this hWnd. NativeMethods.SetParent(_edgeBarControl.Handle, Handle); // Show the child control. NativeMethods.ShowWindow(_edgeBarControl.Handle, ShowWindowCommands.Maximize); }
private EdgeBarPage AddPage(object theDocument, EdgeBarControl edgeBarControl) { EdgeBarPage edgeBarPage = null; IntPtr hWndPage = IntPtr.Zero; // We use the IUnknown pointer of the document as the dictionary key. IntPtr pUnk = Marshal.GetIUnknownForObject(theDocument); Marshal.Release(pUnk); // Only add a new EdgeBarPage if one hasn't already been added. if (!_edgeBarPageDictionary.ContainsKey(pUnk)) { if (_myAddIn.ResourceAssembly != null) { System.Reflection.Assembly resourceAssembly = _myAddIn.ResourceAssembly; // If ResourceAssembly is null, default to the currently executing assembly. if (resourceAssembly == null) { resourceAssembly = Assembly.GetExecutingAssembly(); } hWndPage = new IntPtr(_edgeBar.AddPageEx(theDocument, resourceAssembly.Location, edgeBarControl.BitmapID, edgeBarControl.ToolTip, 2)); } // ISolidEdgeBarEx.AddPage() may return null. if (!hWndPage.Equals(IntPtr.Zero)) { edgeBarPage = new EdgeBarPage(hWndPage, theDocument, edgeBarControl); } _edgeBarPageDictionary.Add(pUnk, edgeBarPage); } else { edgeBarPage = _edgeBarPageDictionary[pUnk]; } return(edgeBarPage); }
public EdgeBarPage(IntPtr hWnd, object theDocument, EdgeBarControl edgeBarControl) : this(hWnd, (SolidEdgeFramework.SolidEdgeDocument)theDocument, edgeBarControl) { }