/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. VectorReferenceLauncher vrl = Control as VectorReferenceLauncher; if (vrl != null) { vrl.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); VectorReferenceView view = (VectorReferenceView)vrl.MainControl; view.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); } } // Dispose unmanaged resources here, whether disposing is true or false. base.Dispose(disposing); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.m_vectorRefView = CreateVectorReferenceView(); this.SuspendLayout(); // // m_panel // this.m_panel.BackColor = System.Drawing.SystemColors.Window; this.m_panel.Name = "m_panel"; // // m_btnLauncher // this.m_btnLauncher.Name = "m_btnLauncher"; // // m_vectorRefView // this.m_vectorRefView.AutoScroll = false; this.m_vectorRefView.EditingHelper.DefaultCursor = null; this.m_vectorRefView.Dock = System.Windows.Forms.DockStyle.Fill; this.m_vectorRefView.Location = new System.Drawing.Point(0, 0); this.m_vectorRefView.Name = "m_vectorRefView"; this.m_vectorRefView.Size = new System.Drawing.Size(250, 20); this.m_vectorRefView.TabIndex = 2; // // VectorReferenceLauncher // this.Controls.Add(this.m_vectorRefView); this.Controls.Add(this.m_panel); this.MainControl = this.m_vectorRefView; this.Name = "VectorReferenceLauncher"; this.Size = new System.Drawing.Size(250, 20); this.Controls.SetChildIndex(this.m_vectorRefView, 0); this.Controls.SetChildIndex(this.m_panel, 1); this.ResumeLayout(false); }
/// <summary> /// Handle changes in the size of the underlying view. /// </summary> protected void OnViewSizeChanged(object sender, FwViewSizeEventArgs e) { // For now, just handle changes in the height. VectorReferenceLauncher vrl = (VectorReferenceLauncher)this.Control; VectorReferenceView view = (VectorReferenceView)vrl.MainControl; int hMin = ContainingDataTree.GetMinFieldHeight(); int h1 = view.RootBox.Height; Debug.Assert(e.Height == h1); int hOld = TreeNode.Height; int hNew = Math.Max(h1, hMin) + 3; if (hNew != hOld) { this.Height = hNew - 1; // JohnT: don't know why we need this, vrl is the slice's control and is supposed to // be docked to fill the slice. But if we don't do it, there are cases where // narrowing the window makes the slice higher but not the embedded control. // The tree node is also supposed to be docked, but again, if we don't do this // then the tree node doesn't fill the height of the window, and clicks at the // bottom of it may not work. TreeNode.Height = hNew - 1; vrl.Height = hNew - 1; // This seems to be really not needed, the view height is docked to the launcher's. // view.Height = hNew - 1; } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { } m_vectorRefView = null; // Should all be disposed automatically, since it is in the Controls collection. base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { } m_vectorRefView = null; // Should all be disposed automatically, since it is in the Controls collection. base.Dispose(disposing); }
protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); if (this.Width == m_dxLastWidth) { return; } m_dxLastWidth = Width; // BEFORE doing anything, actions below may trigger recursive call. VectorReferenceLauncher vrl = (VectorReferenceLauncher)this.Control; VectorReferenceView view = (VectorReferenceView)vrl.MainControl; view.PerformLayout(); int h1 = view.RootBox.Height; int hNew = Math.Max(h1, ContainingDataTree.GetMinFieldHeight()) + 3; if (hNew != this.Height) { this.Height = hNew; } }
protected override void SetupControls(IPersistenceProvider persistenceProvider, Mediator mediator, StringTable stringTbl) { VectorReferenceLauncher vrl = new VectorReferenceLauncher(); vrl.Initialize(m_cache, m_obj, m_flid, m_fieldName, persistenceProvider, mediator, DisplayNameProperty, BestWsName); // TODO: Get better default 'best ws'. vrl.ConfigurationNode = ConfigurationNode; this.Control = vrl; vrl.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); VectorReferenceView view = (VectorReferenceView)vrl.MainControl; view.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged); // We don't want to be visible until later, since otherwise we get a temporary // display in the wrong place with the wrong size that serves only to annoy the // user. See LT-1518 "The drawing of the DataTree for Lexicon/Advanced Edit draws // some initial invalid controls." Becoming visible when we set the width and // height seems to delay things enough to avoid this visual clutter. vrl.Visible = false; }
// protected CmObject[] Contents // { // get // { // int[] hvos = ContentsHvos; // CmObject[] cmos = new CmObject[hvos.Length]; // int i = 0; // foreach(int hvo in hvos) // cmos[i++] = CmObject.CreateFromDBObject(m_cache, hvo); // return cmos; // } // } // // protected int[] ContentsHvos // { // get { return m_cache.GetVectorProperty(m_obj.Hvo, m_flid); } // } #endregion // Other methods #region Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(VectorReferenceLauncher)); this.m_vectorRefView = CreateVectorReverenceView(); this.SuspendLayout(); // // m_panel // this.m_panel.BackColor = System.Drawing.SystemColors.Window; this.m_panel.Name = "m_panel"; // // m_btnLauncher // this.m_btnLauncher.Name = "m_btnLauncher"; // // m_vectorRefView // this.m_vectorRefView.AutoScroll = false; this.m_vectorRefView.EditingHelper.DefaultCursor = null; this.m_vectorRefView.Dock = System.Windows.Forms.DockStyle.Fill; this.m_vectorRefView.Location = new System.Drawing.Point(0, 0); this.m_vectorRefView.Name = "m_vectorRefView"; this.m_vectorRefView.Size = new System.Drawing.Size(250, 20); this.m_vectorRefView.TabIndex = 2; // // VectorReferenceLauncher // this.Controls.Add(this.m_vectorRefView); this.Controls.Add(this.m_panel); this.MainControl = this.m_vectorRefView; this.Name = "VectorReferenceLauncher"; this.Size = new System.Drawing.Size(250, 20); this.Controls.SetChildIndex(this.m_vectorRefView, 0); this.Controls.SetChildIndex(this.m_panel, 1); this.ResumeLayout(false); }